fix(sidebar): keep hovered label on one line to match expanded#1141
Open
JeanMarcMilletScality wants to merge 1 commit into
Open
fix(sidebar): keep hovered label on one line to match expanded#1141JeanMarcMilletScality wants to merge 1 commit into
JeanMarcMilletScality wants to merge 1 commit into
Conversation
When hovering a collapsed sidebar, the overlay (.sc-sidebar) uses width: fit-content while staying position: relative, so its containing block is the collapsed wrapper (~46px). fit-content was capped at that width, wrapping long labels (e.g. "Identity Providers") to two lines and shifting the centered icon. Forcing the label to a single line makes its min-content width the full text width, so fit-content expands to fit it, matching the expanded layout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
/approve |
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.
Problem
When the sidebar is collapsed and you hover it (with
hoverable), the flyout is meant to look identical to the expanded sidebar. But a long label (e.g. Identity Providers) wraps to two lines instead of one, and the icon shifts slightly.Before:

After:

Root cause
On hover, the overlay (
.sc-sidebar) useswidth: fit-contentwhile stayingposition: relative, so its containing block is the collapsed wrapper (~sidebarWidth, ~46px).fit-contentis therefore capped at that width, forcing long labels to wrap — which grows the row height and nudges the centered icon.Fix
Force the label onto a single line with
white-space: nowrap. The label's min-content width then becomes the full text width, sofit-contentexpands to fit it — matching the expanded layout. One-line CSS change, no behavioural change to collapsed or expanded states.Testing
Verified in Storybook (
Components/Navigation/Sidebar → HoverableSidebar) with a long label: the hovered flyout now renders the label on a single line with no icon shift.🤖 Generated with Claude Code