Skip to content

Commit fa40a6d

Browse files
committed
fix(rich-markdown-editor): catch Tailwind's self-targeting [&]:text-* 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.
1 parent ba4ef59 commit fa40a6d

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.test.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,18 @@ describe('MentionChipView', () => {
6161
const chip = container.querySelector('.mention-chip') as HTMLElement
6262
expect(chip).not.toBeNull()
6363

64-
// Any bare (non-descendant-scoped) `text-*` utility on the wrapper itself would regress this
65-
// fix — not just the specific old `text-[var(--text-primary)]` class. Rather than enumerate
66-
// every Tailwind color-naming scheme (arbitrary value, shade-suffixed, semantic theme tokens
67-
// like `text-primary`/`text-muted-foreground`, keywords), flag ANY unscoped `text-*` token:
68-
// none is legitimate on this wrapper today, so this can only ever be a color utility slipping
69-
// back in. A genuinely new, non-color `text-*` need (e.g. a font-size utility) should fail this
70-
// test and force an explicit update, not be silently allowed through.
64+
// Any `text-*` utility targeting the wrapper itself — bare, or Tailwind's self-targeting
65+
// `[&]:text-*` arbitrary variant (as opposed to a descendant variant like `[&>svg]:text-*`,
66+
// which the icon rule below legitimately uses) — would regress this fix, not just the specific
67+
// old `text-[var(--text-primary)]` class. Rather than enumerate every Tailwind color-naming
68+
// scheme (arbitrary value, shade-suffixed, semantic theme tokens like `text-primary`/
69+
// `text-muted-foreground`, keywords), flag ANY such token: none is legitimate on this wrapper
70+
// today, so this can only ever be a color utility slipping back in. A genuinely new, non-color
71+
// `text-*` need (e.g. a font-size utility) should fail this test and force an explicit update,
72+
// not be silently allowed through.
7173
const ownTextUtilities = chip.className
7274
.split(/\s+/)
73-
.filter((cls) => !cls.startsWith('[&') && cls.startsWith('text-'))
75+
.filter((cls) => cls.startsWith('text-') || cls.startsWith('[&]:text-'))
7476
expect(ownTextUtilities).toEqual([])
7577

7678
// The icon's own monochrome fallback is unrelated and must be untouched by this fix.

0 commit comments

Comments
 (0)