Repository navigation
fix(composer): scale the mode chip reservation with the appearance font - #1879
Merged
Merged
Conversation
The trigger reserved a fixed 96px while its label multiplies --font-scale, so at 115% the localized mode name clipped to a single character plus an ellipsis. Scale the reservation with the same token; the fixed-size icon and caret leave the slack on the label, which is where clipping happened (vastsa#1866).
This branch was previously deployed
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.
What this fixes
Fixes #1866 — at 115% appearance font (「超大杯」) the composer's mode trigger clips 「智能体」 to 「智…」; only one character plus the caret remains, so the user cannot tell which mode is active.
Root cause
theme-overrides.cssreserved a fixed 96px for.composer-mode-chip(width/min-width/max-width/flex-basis), while the label inside multiplies the appearance token:.composer-mode-chip-labelusestext-sm→calc(12px * var(--font-scale)). Per the reporter's arithmetic, at 100% the three-character zh label fits with ~2px to spare; at 115% it needs 41.4px against 38px of available width and thetext-overflow: ellipsison the label does the rest.Change
Scale the reservation with the same token the label uses:
This keeps the original intent of the rule — a stable trigger width across Agent/Plan/Goal switches and localized labels — while making it track the label's font. The mode icon (14px) and caret (12px) keep their fixed pixel sizes, so the scaled reservation over-provisions slightly at >100%; the slack lands on the label, which is exactly where the clipping happened. Below 100% the chip shrinks proportionally, matching its content.
Verification
test/composer-chip-descenders.test.mjs— 5/5 pass; the "mode selector reserves the longest localized label width" contract now pins thecalc(96px * var(--font-scale, 1))form for all four properties instead of the fixed 96px.One commit on current
main(4bedbb4).