Skip to content

fix(rich-markdown-editor): fix mention chip losing ambient color inside links/h6#5594

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix-mention-chip-ambient-color
Jul 11, 2026
Merged

fix(rich-markdown-editor): fix mention chip losing ambient color inside links/h6#5594
waleedlatif1 merged 4 commits into
stagingfrom
fix-mention-chip-ambient-color

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Follow-up to fix(rich-markdown-editor): stop image dupe-uploads on drag/paste; fix link color under bold/italic/strikethrough/code #5573 — auditing the whole "own explicit color always beats inherited color" bug class turned up one more instance: the @-mention chip's label hardcoded text-[var(--text-primary)], which silently overrides ambient color from a link (blue) or h6 heading (dimmer --text-secondary) when a mention sits inside either — same failure mode already fixed for strong/em/code/del/s.
  • Removed the hardcoded color entirely (redundant with the prose default anyway) so the label inherits correctly everywhere, same fix as strong/em/code. The icon's own monochrome fallback is untouched.

Type of Change

  • Bug fix

Testing

  • New test renders MentionChipView directly and asserts the wrapper carries no explicit text-color class; verified it fails against the pre-fix className
  • Full rich-markdown-editor suite (412 tests) + type-check + biome all pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…e class as #5573)

Auditing the whole "an element's own explicit color always wins over an inherited one" bug class
(previously fixed for strong/em/code/del/s vs. links and h6 in #5573) turned up one more instance:
the @-mention chip's label hardcoded text-[var(--text-primary)], which is redundant with the prose
default anyway (matching the strong/em/code precedent) and silently overrides any ambient color a
mention's container legitimately sets — a link's blue, or h6's dimmer --text-secondary — since a
mention is inline content that can appear inside either (e.g. "###### see @some-file").

Removed the hardcoded color entirely so the label inherits correctly in every context, same fix as
strong/em/code. The icon's own monochrome --text-icon fallback is untouched (icons intentionally
don't follow ambient text color).

New test renders MentionChipView directly and asserts the wrapper carries no explicit text-color
utility class; verified it fails against the pre-fix className.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 11, 2026 5:57pm

Request Review

@cursor

cursor Bot commented Jul 11, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Small, localized CSS/class change in the rich markdown mention UI with a targeted regression test and no auth or data impact.

Overview
@mention chip labels no longer force --text-primary on the wrapper, so mentions inside links or h6 pick up the parent’s color instead of overriding it—the same “explicit color beats inheritance” issue already fixed for strong/em/code.

MentionChipView is exported for direct unit tests. A new test renders the chip and fails if any wrapper-level text-* / [&]:text-* utility is added back; the SVG [&>svg]:text-[var(--text-icon)] rule is unchanged.

Reviewed by Cursor Bugbot for commit fa40a6d. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes mention chip coloring in the rich markdown editor.

  • Removes the wrapper's hardcoded text color so labels inherit link and heading colors.
  • Keeps the SVG icon fallback color on descendant icons.
  • Adds a focused test that rejects wrapper-level text-* utilities, including self-targeting variants.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.tsx Removes the mention chip wrapper's explicit text color while preserving the descendant SVG icon color rule.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.test.tsx Adds regression coverage that blocks wrapper-level text color utilities and keeps the icon fallback check.

Reviews (5): Last reviewed commit: "fix(rich-markdown-editor): catch Tailwin..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates the rich markdown mention chip so its label inherits surrounding text color.

  • Removes the explicit primary text color from the mention chip wrapper.
  • Keeps the mention icon fallback color unchanged.
  • Exports MentionChipView for direct regression coverage.
  • Adds a jsdom test for the chip wrapper class.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The default prose color still supplies the normal label color.
  • The icon color class remains in place.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.tsx Removes the chip label's explicit primary text color so the wrapper can inherit prose, link, and heading colors while preserving icon styling.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.test.tsx Adds a focused jsdom regression test that verifies the mention chip wrapper no longer includes the primary text color utility.

Reviews (1): Last reviewed commit: "fix(rich-markdown-editor): fix mention c..." | Re-trigger Greptile

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4ae69d2. Configure here.

…d beyond the exact old class

Greptile: the test only matched the literal old text-[var(--text-primary)] string — a future edit
swapping it for e.g. text-[var(--text-secondary)] or text-blue-500 would still silently reintroduce
the ambient-color bug and pass this test. Now checks every non-descendant-scoped (excludes the
[&>svg]: icon rule) text-* utility on the wrapper against a color-shaped pattern (arbitrary value,
color-shade pairs, or a named color keyword), so any bare text color slipping back in fails.
Verified against a text-blue-500 regression.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9465362. Configure here.

…he mention-chip test

Greptile: the color-shaped regex still missed semantic theme tokens (text-primary,
text-muted-foreground, text-chart-1, etc.) since they don't match a shade-suffix or bracket pattern.
Rather than keep enumerating Tailwind's color-naming schemes, flag ANY unscoped text-* utility on
the wrapper — none is legitimate on this chip today, so this can only be a color slipping back in.
Verified against text-primary/text-muted-foreground/text-chart-1 regressions.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit ba4ef59. Configure here.

… variant too

Greptile: the previous filter excluded ANY class starting with `[&`, which also dropped Tailwind's
self-targeting arbitrary variant (`[&]:text-primary` applies to the element itself, same as a bare
`text-primary`) — only descendant variants like `[&>svg]:text-*` should be excluded. Now explicitly
catches both the bare and `[&]:` forms. Verified against a `[&]:text-primary` regression.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit fa40a6d. Configure here.

@waleedlatif1 waleedlatif1 merged commit 591516a into staging Jul 11, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the fix-mention-chip-ambient-color branch July 11, 2026 18:04
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.

1 participant