fix(icon): pin RuiIcon at --rui-icon-size in flex containers#526
Merged
kelsos merged 1 commit intorotki:mainfrom Apr 28, 2026
Merged
fix(icon): pin RuiIcon at --rui-icon-size in flex containers#526kelsos merged 1 commit intorotki:mainfrom
kelsos merged 1 commit intorotki:mainfrom
Conversation
A flex item's default `flex-shrink: 1` lets it compress below its declared width when a sibling exerts main-axis pressure — an explicit `width` doesn't stop it. In `RuiButton variant="list"` the label is `w-full text-nowrap`, so a long label inside a width-bounded menu squeezes the SVG sibling along the main axis while the height stays at the var-driven box, producing a sliver glyph (e.g. ~6×18 instead of 18×18). `RuiIcon`'s box is always intentionally driven by `--rui-icon-size`, so flex shrinking is never the desired behavior. `shrink-0` on the base classes pins every icon at its declared size for every consumer (list buttons, chips, toolbars) without per-call-site overrides.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #526 +/- ##
=======================================
Coverage 84.80% 84.80%
=======================================
Files 145 145
Lines 5260 5260
Branches 1571 1571
=======================================
Hits 4461 4461
Misses 799 799 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
A flex item's default
flex-shrink: 1lets it compress below its declared width when a sibling exerts main-axis pressure — an explicitwidthdoesn't prevent that. InRuiButton variant="list"the label isw-full text-nowrap, so a long label inside a width-bounded menu squeezes theRuiIconSVG along the main axis while the height stays at the var-driven box, producing a sliver glyph (e.g. ~6×18 instead of 18×18).RuiIcon's box is always intentionally driven by--rui-icon-size, so flex shrinking is never the desired behavior. Addingshrink-0to the base classes pins every icon at its declared size for every consumer (list buttons, chips, toolbars) without per-call-site overrides.Repro before the fix
The eye icon renders at ~6 × 18px because the long label is
w-fulland pushes the SVG below its declared width.Change
RuiIcon.vue: prependshrink-0to the baseiconStylesslot.RuiIcon.spec.ts: regression guard assertingshrink-0is present so a future refactor can't silently drop it.Test plan
pnpm test -- --run RuiIcon— 1082 / 1082 passvariant="list"menu (e.g. rotki's history-event action menu) — icon renders at 18×18 instead of being squeezed