feat(fuselage)!: Render message mentions as plain text instead of pills - #2155
Open
ivans-netto wants to merge 5 commits into
Open
feat(fuselage)!: Render message mentions as plain text instead of pills#2155ivans-netto wants to merge 5 commits into
ivans-netto wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: bb5a202 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Align the Web mention layout with Mobile: drop the background pill and render mentions as regular text with a distinct font color and medium (p2m) weight, using the status-font tokens so both themes get proper shades (critical/@me on-danger, relevant/@all-@here on-service-1, link/rooms on-info, other keeps the default font color). Highlights become display: inline, so a line containing a mention is no longer taller than a line without one. BREAKING CHANGE: the message-highlight-colors-background-* and message-highlight-border-radius theme variables no longer exist. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The link variant declared the theme key 'message-highlight-colors-other-color', the same one used by the other variant, so setting that custom property recolored both at once. Harmless while both variants shared the same pill styling; now that link is blue and other uses the default font color, they need to be themable independently. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ivans-netto
force-pushed
the
mention-layout-unification
branch
2 times, most recently
from
August 11, 2026 18:29
413f9aa to
358ca3e
Compare
…space templates.focus-state keeps a 1px transparent border on the element so the ring does not shift layout when it appears. On an inline run that border sits inside the line, so every mention carried a fixed 1px on each side — 2px of spacing that does not come from the font. Invisible while the pill painted its own box, noticeable once mentions are plain text. Draw the ring with an outline instead: it paints outside the box without taking up space, so focus still cannot shift layout and the gap around a mention is now font-derived. Measured on the With Mentions story: each highlight box matches its text width exactly, focused or not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Add a 'With Mentions' story that writes the same sentence twice, once with the mentions rendered without their @/# symbols and once with them — the two states the mention symbol setting toggles between. Every variant shows up once in each, so the plain-text treatment can be judged in context. Also fix the Default story, which repeated the same critical mention five times and mislabeled the channel mention as the other variant — that one renders in the other-user colour, not the link blue gazzodown uses for channels. Keep one mention per variant, add the missing @here, rename 'highlighted text' to 'highlighted word' to match the feature name, and add the spaces the removed pill padding used to fake. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Regenerated with the CI Playwright container for the new mention rendering, the reworked stories and the font-derived spacing, plus a new baseline for the With Mentions story. No other story produced a pixel diff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ivans-netto
force-pushed
the
mention-layout-unification
branch
from
August 12, 2026 17:20
358ca3e to
bb5a202
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes (including videos or screenshots)
Mentions are rendered inconsistently between the Web and Mobile clients: Web draws them as a coloured pill, Mobile renders them as ordinary text in a distinct colour. This aligns Web with the Mobile approach — the same treatment WhatsApp uses — so a mention reads as part of the sentence instead of as a badge dropped into it.
MessageHighlightnow renders regular text: no background, no border radius, no horizontal padding. Each variant keeps its meaning through colour and a medium (p2m) weight.criticalstatus-font-on-danger(red)relevant@all/@herestatus-font-on-service-1(orange)linkstatus-font-on-info(blue)otherstatus-font-on-warning(amber)All four resolve through semantic tokens, so light, dark and high-contrast themes each get their own shade instead of a single hardcoded value.
Before
After
With and without
@#symbolsA new
With Mentionsstory writes the same sentence twice, with the mentions rendered without and with their@/#symbols — the two states the mention symbol setting toggles between:Also in here
display: inline-blockcontributed the element's border to the line box, so a line containing a mention was ~1.5px taller than a line without one; it isdisplay: inlinenow, and the Default story's body measures exactly 4 × 20px of line-height. Andtemplates.focus-statereserved a 1px transparent border to keep the focus ring from shifting layout, which on an inline run put a fixed 1px on each side of every mention — the ring is drawn with anoutlineinstead, which paints outside the box without taking up space. Each highlight box now matches its text width exactly, focused or not.linkvariant gets its own theme variable. It declared the theme keymessage-highlight-colors-other-color— the same one theothervariant uses — so setting that custom property recoloured both at once. Harmless while both variants shared the same pill, but they are now visually distinct and need to be themable independently. It readsmessage-highlight-colors-link-colorfrom this PR on.With Mentionsstory above, and the Default story now shows one mention per variant instead of repeating the same one five times. It also stops labelling the channel mention asother, adds the missing@here, renameshighlighted texttohighlighted wordto match the feature name, and restores the spaces the pill padding used to fake.Breaking: the
message-highlight-colors-background-*andmessage-highlight-border-radiustheme variables no longer exist, since nothing paints a background anymore. Nothing in the Rocket.Chat codebase reads them.Issue(s)
DSN-186
Further comments
Why colour + weight rather than a lighter pill. A pill competes with the message text for attention and forces vertical padding into a line box that is only 20px tall, which is what made mentions push their line taller. Colour plus medium weight carries the same "this is a mention" signal at text weight, and it is what Mobile already does, so the two clients stop diverging.
Accessibility. Removing the pill means the mention colour is now read against the room surface rather than against a solid badge, so I checked every combination. All pass WCAG AA for body text in both themes; the tightest is 5.34:1 (
otheron light).criticalrelevantlinkotherThose figures are the palette values that actually apply at runtime. Worth flagging separately:
colors.status-font(on-warning)falls back toy800(#AC892F, 3.29:1 on white) when the palette custom properties are absent, because of the pre-existingTODO(design)instyles/colors.scsswhere the SCSS fallback and the token disagree (y800vsy900). That fallback only shows up for a consumer loadingfuselage.csswithout the palette, and it is not introduced here, butotheris the first mention variant to depend on that particular token.Visual regression. Ran the full suite in the CI Playwright container without
--update-snapshotsfirst, then regenerated only the affected baselines with--grep: the Default one, plus a new baseline for theWith Mentionsstory. No other story produced a pixel diff. A handful of stories fail locally by timing out while loading, never by pixel difference, and the failing set changes between runs — local flakiness rather than regression.Layout/PositionAnimated Left Startdid diff once by ~1px on an animated element and passed on other runs, so I left its baseline alone.Follow-up outside this repo. Highlighted words are not rendered by Fuselage: the web client wraps them in
<mark class="highlight-text">, styled inapps/meteor/app/theme/client/imports/general/base_old.css, and they are still a white-on-red pill. They need the same treatment in Rocket.Chat for the change to be consistent end to end.