Skip to content

fix: resolve dark mode contrast issues on legal pages - #7789

Open
AnkitRewar11 wants to merge 7 commits into
layer5io:masterfrom
AnkitRewar11:fix/dark-mode-legal-clean
Open

fix: resolve dark mode contrast issues on legal pages#7789
AnkitRewar11 wants to merge 7 commits into
layer5io:masterfrom
AnkitRewar11:fix/dark-mode-legal-clean

Conversation

@AnkitRewar11

@AnkitRewar11 AnkitRewar11 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description
This PR fixes #7677

In dark mode, text on Code of Conduct and Terms of Service pages was invisible (dark text on dark background). On Privacy page, the data processing table was rendering in light mode regardless of user's theme preference. Issue resolved only after manually switching theme.

Root Cause

  • terms.style.js had no color properties defined, so text became invisible in dark mode
  • privacy/index.jsSistentThemeProvider was rendering with wrong initial theme before ThemeManager resolved correct theme from localStorage
  • sub-processors/index.jsSistentThemeProvider was not re-mounting on theme change
  • cookie-notice/index.js - used the same table rendering pattern and was affected by the same theme initialization behavior.

Changes Made

  • terms.style.js: added props.theme.whiteToBlack color for all text elements to ensure proper contrast in dark and light mode
  • privacy/index.js: added didLoad flag to defer SistentThemeProvider render until theme is fully resolved, preventing incorrect light mode flash on table
  • sub-processors/index.js: added key={isDark ? "dark" : "light"} and didLoad flag to SistentThemeProvider to force re-mount on theme change
  • cookie-notice/index.js: added didLoad flag and key prop to SistentThemeProvider (same table setup as privacy page)

Affected Pages

  1. Code of Conduct
  2. Terms of Service
  3. Privacy Policy
  4. Cookie Notice
  5. Sub-Processors

Notes for Reviewers
No new dependencies added. Changes are scoped only to legal pages.

Signed commits

  • Yes, I signed my commits.
Screen.Recording.2026-06-12.003525.mp4

Summary by CodeRabbit

  • Bug Fixes
    • Improved rendering of legal tables and notices during page load.
    • Enhanced dark and light mode compatibility across legal pages.
    • Updated Terms page text colors for improved readability across headings, paragraphs, and lists.

Signed-off-by: ankitrewar11 <ankitrewar11@gmail.com>
@AnkitRewar11

Copy link
Copy Markdown
Contributor Author

Hey @Rajesh-Nagarajan-11, @banana-three-join, @KatalKavya96, @rishiraj38 👋
I closed the previous PR since it got cluttered with merge commits and opened a new clean PR with all the requested changes.
Whenever you have some time, could you please take a look and let me know if anything else needs to be updated?

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for PR #7789 removed.

This PR preview was automatically pruned because we keep only the 6 most recently updated previews on GitHub Pages to stay within deployment size limits.

If needed, push a new commit to this PR to generate a fresh preview.

@KatalKavya96 KatalKavya96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnkitRewar11 I can see the issue on the Code of Conduct and Terms of Service pages, and both the issue description and reproduction steps also point to these two pages only.

Could you please clarify why changes were made to additional pages as well? The expected fix seems to be limited to Code of Conduct and Terms of Service.

@AnkitRewar11

Copy link
Copy Markdown
Contributor Author

@KatalKavya96 These pages were affected because they all share the same terms.style.js component. The dark mode contrast fix was made in this shared file, so it automatically applied to all legal pages using it.

Also, Privacy Policy, Cookie Notice, and Sub-Processors use the same dark mode setup (SistentThemeProvider + useStyledDarkMode), so they needed the same fix for consistent rendering.

Limiting the change to only Code of Conduct and Terms of Service would have left the same issue on the other legal pages.

@KatalKavya96 KatalKavya96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnkitRewar11 Ok, fair enough. Thanks for clarifying.

I rechecked the preview as well, and the fix looks good overall. Since the PR covers both the shared terms.style.js contrast issue and the theme rendering issue on Privacy Policy, Cookie Notice, and Sub-Processors, could you please update the PR description to mention this clearly?

Rest all looks good to me.

@KatalKavya96
KatalKavya96 requested a review from rishiraj38 June 13, 2026 14:12
@Bhumikagarggg

Copy link
Copy Markdown
Contributor

@AnkitRewar11 Thank you for your contribution! Let's discuss this during the website call tomorrow at 5:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would 🙂

@AnkitRewar11

Copy link
Copy Markdown
Contributor Author

@rishiraj38 @Rajesh-Nagarajan-11 please take a look.

Signed-off-by: ankitrewar11 <ankitrewar11@gmail.com>
@AnkitRewar11
AnkitRewar11 force-pushed the fix/dark-mode-legal-clean branch from a560db7 to d6136fa Compare June 18, 2026 18:24
@Bhumikagarggg

Copy link
Copy Markdown
Contributor

@AnkitRewar11 Thank you for your contribution! Let's discuss this during the website call tomorrow at 5:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would 🙂

@Sbragul26 Sbragul26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Sbragul26

Copy link
Copy Markdown
Member

createTheme is currently being called inside the component, so a new theme object is created on every render. Since the theme looks static, what are your thoughts on moving it outside the component so it’s created only once and avoids unnecessary re-creation on each render?

@AnkitRewar11

Copy link
Copy Markdown
Contributor Author

@Sbragul26 You're right bro. This change will prevent unnecessary work on each render and significantly improve performance. I've updated it. Thanks for the heads-up!

@AasthathecoderX
AasthathecoderX self-requested a review July 13, 2026 06:31
@AasthathecoderX

Copy link
Copy Markdown
Contributor

@AnkitRewar11 ,LGTM

@dhruveshmishra

Copy link
Copy Markdown
Contributor

@AnkitRewar11 LGTM

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Legal pages now initialize custom themes after mounting and remount providers when the color mode changes. Terms page text also uses the theme’s whiteToBlack color.

Changes

Legal theme rendering

Layer / File(s) Summary
Client-side theme initialization
src/sections/Company/Legal/cookie-notice/index.js, src/sections/Company/Legal/privacy/index.js, src/sections/Company/Legal/sub-processors/index.js
Custom themes move to module scope. Each component renders its SistentThemeProvider after mount with a mode-based key.
Terms page text styling
src/sections/Company/Legal/terms.style.js
The page header applies whiteToBlack to headings, paragraphs, and list items from h2 through h6.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: project/meshery

Suggested reviewers: rishiraj38

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: fixing dark-mode contrast issues on legal pages.
Linked Issues check ✅ Passed The changes address issue [#7677] by applying theme-aware contrast and initializing legal-page themes during navigation.
Out of Scope Changes check ✅ Passed All changes remain within the legal-page theme, text contrast, and dark-mode rendering objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/sections/Company/Legal/cookie-notice/index.js (1)

161-198: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Render all legal tables during SSR and the initial client render.

didLoad is false in SSR and becomes true only in useEffect in all three confirmed files. This omits the tables from the generated HTML and leaves them unavailable when JavaScript fails or is disabled. The table insertion also shifts the following content because no space is reserved. Keep the table subtree mounted while updating the theme after hydration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/sections/Company/Legal/cookie-notice/index.js` around lines 161 - 198,
Render the legal table subtrees unconditionally during SSR and the initial
client render instead of gating them on didLoad, while preserving theme updates
after hydration through SistentThemeProvider. Apply this change at the table
blocks in src/sections/Company/Legal/cookie-notice/index.js (lines 161-198),
src/sections/Company/Legal/privacy/index.js (lines 195-238), and
src/sections/Company/Legal/sub-processors/index.js (lines 240-298); ensure the
existing layout reserves space and the tables remain available without
JavaScript.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/sections/Company/Legal/terms.style.js`:
- Around line 47-49: Update the dark-mode text-color rule in the terms styles so
the h2–h6, p, and li selector is scoped under .terms-content instead of the
current scope. Preserve the existing theme.whiteToBlack color value and selector
coverage.

---

Outside diff comments:
In `@src/sections/Company/Legal/cookie-notice/index.js`:
- Around line 161-198: Render the legal table subtrees unconditionally during
SSR and the initial client render instead of gating them on didLoad, while
preserving theme updates after hydration through SistentThemeProvider. Apply
this change at the table blocks in
src/sections/Company/Legal/cookie-notice/index.js (lines 161-198),
src/sections/Company/Legal/privacy/index.js (lines 195-238), and
src/sections/Company/Legal/sub-processors/index.js (lines 240-298); ensure the
existing layout reserves space and the tables remain available without
JavaScript.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4d733226-78a6-4c4f-b4c8-5cb7a60516e9

📥 Commits

Reviewing files that changed from the base of the PR and between 2c2e1c9 and 0b2ca52.

📒 Files selected for processing (4)
  • src/sections/Company/Legal/cookie-notice/index.js
  • src/sections/Company/Legal/privacy/index.js
  • src/sections/Company/Legal/sub-processors/index.js
  • src/sections/Company/Legal/terms.style.js

Comment thread src/sections/Company/Legal/terms.style.js

@KhushamBansal KhushamBansal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dark mode text rendering issue on Code of Conduct and Terms of Service pages (fixed after refresh)

8 participants