Skip to content

Comments

Fix: ensure email text is visible in light mode (issue #1966)#1994

Merged
ahmetskilinc merged 2 commits intoMail-0:stagingfrom
tanayyo1:patch-2
Aug 25, 2025
Merged

Fix: ensure email text is visible in light mode (issue #1966)#1994
ahmetskilinc merged 2 commits intoMail-0:stagingfrom
tanayyo1:patch-2

Conversation

@tanayyo1
Copy link
Contributor

@tanayyo1 tanayyo1 commented Aug 19, 2025

This PR fixes an issue where some email content was unreadable in light mode due to white text on a white background.
Added a useEffect that checks all email elements after render, and if any have white text, it sets them to black for visibility.


Summary by cubic

Ensures email text stays visible in light mode by turning white text to black after render inside the email shadow root. Fixes #1966 (white text on white background).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed instances where some emails showed white text on a white background in light mode, especially within embedded or third-party content.
    • Text now adapts to the light theme and appears in a readable dark color across nested elements, including shadow DOM content.
    • Improves readability, accessibility, and visual consistency in light mode.

… mode

Fixes issue Mail-0#1966 (white text on white background)Checks all email content elements in light mode.
If any text is white, sets it to black for readability.
.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Introduces a useEffect in mail-content.tsx that, on processedData or resolvedTheme changes, inspects elements within the component’s shadow root. In light theme only, it computes each element’s color and overrides pure white text (rgb(255, 255, 255)) with inline black (#000). No public API changes.

Changes

Cohort / File(s) Summary of Changes
Theme color normalization in shadow DOM
apps/mail/components/mail/mail-content.tsx
Added useEffect that, when in light theme, traverses shadowRoot descendants, checks computed styles, and forces white text to black via inline styles. Scoped to processedData and resolvedTheme updates; early returns if shadowRootRef is absent.

Sequence Diagram(s)

sequenceDiagram
    participant React as MailContent Component
    participant Effect as useEffect (theme/data)
    participant Shadow as shadowRootRef.current
    participant DOM as Descendant Elements

    React->>Effect: processedData/resolvedTheme change
    alt shadowRootRef exists
        Effect->>Shadow: querySelectorAll("*")
        alt resolvedTheme == "light"
            loop For each element
                Effect->>DOM: getComputedStyle(el).color
                alt color == rgb(255, 255, 255)
                    Effect->>DOM: el.style.color = "#000"
                else color != white
                    Note right of DOM: No change
                end
            end
        else not light theme
            Note right of Effect: Skip color overrides
        end
    else no shadowRootRef
        Note right of Effect: Return early
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

design

Suggested reviewers

  • ahmetskilinc
  • MrgSub

Poem

In the shadow, text went white on white,
We flipped the bits to bring back light.
One small loop for DOM, a clear-eyed run,
Inline thrust—now readable, done.
Ship it fast, iterate tonight. 🚀

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot requested review from MrgSub and ahmetskilinc August 19, 2025 21:37
@coderabbitai coderabbitai bot added the design Improvements & changes to design & UX label Aug 19, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 576dfcc and 6bed516.

📒 Files selected for processing (1)
  • apps/mail/components/mail/mail-content.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{css,js,ts,jsx,tsx,mdx}

📄 CodeRabbit Inference Engine (.cursor/rules/tailwind-css-v4.mdc)

**/*.{css,js,ts,jsx,tsx,mdx}: Chain variants together for composable variants (e.g., group-has-data-potato:opacity-100).
Use new variants such as starting, not-*, inert, nth-*, in-*, open (for :popover-open), and ** for all descendants.
Do not use deprecated utilities like bg-opacity-*, text-opacity-*, border-opacity-*, and divide-opacity-*; use the new syntax (e.g., bg-black/50).
Use renamed utilities: shadow-sm is now shadow-xs, shadow is now shadow-sm, drop-shadow-sm is now drop-shadow-xs, drop-shadow is now drop-shadow-sm, blur-sm is now blur-xs, blur is now blur-sm, rounded-sm is now rounded-xs, rounded is now rounded-sm, outline-none is now outline-hidden.
Use bg-(--brand-color) syntax for CSS variables in arbitrary values instead of bg-[--brand-color].
Stacked variants now apply left-to-right instead of right-to-left.

Files:

  • apps/mail/components/mail/mail-content.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (AGENT.md)

**/*.{js,jsx,ts,tsx}: Use 2-space indentation
Use single quotes
Limit lines to 100 characters
Semicolons are required

Files:

  • apps/mail/components/mail/mail-content.tsx
**/*.{js,jsx,ts,tsx,css}

📄 CodeRabbit Inference Engine (AGENT.md)

Use Prettier with sort-imports and Tailwind plugins

Files:

  • apps/mail/components/mail/mail-content.tsx
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (AGENT.md)

Enable TypeScript strict mode

Files:

  • apps/mail/components/mail/mail-content.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: snehendu098
PR: Mail-0/Zero#1323
File: apps/mail/lib/themes/theme-utils.ts:318-318
Timestamp: 2025-06-24T06:22:58.753Z
Learning: In the Mail-0/Zero theme system (apps/mail/lib/themes/theme-utils.ts), when color themes are being applied, all color values come in HSL format, so there's no need for additional format validation when converting colors with hslToHex().
📚 Learning: 2025-06-24T06:22:58.753Z
Learnt from: snehendu098
PR: Mail-0/Zero#1323
File: apps/mail/lib/themes/theme-utils.ts:318-318
Timestamp: 2025-06-24T06:22:58.753Z
Learning: In the Mail-0/Zero theme system (apps/mail/lib/themes/theme-utils.ts), when color themes are being applied, all color values come in HSL format, so there's no need for additional format validation when converting colors with hslToHex().

Applied to files:

  • apps/mail/components/mail/mail-content.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer

@ahmetskilinc
Copy link
Contributor

hey @tanayy07 can you please check the requested changes?

@tanayyo1
Copy link
Contributor Author

tanayyo1 commented Aug 23, 2025 via email

@ahmetskilinc ahmetskilinc merged commit 86a9564 into Mail-0:staging Aug 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design Improvements & changes to design & UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't see text in email

2 participants