Skip to content

fix(sidebar): keep hovered label on one line to match expanded#1141

Open
JeanMarcMilletScality wants to merge 1 commit into
development/1.0from
fix/sidebar-hover-label-wrap
Open

fix(sidebar): keep hovered label on one line to match expanded#1141
JeanMarcMilletScality wants to merge 1 commit into
development/1.0from
fix/sidebar-hover-label-wrap

Conversation

@JeanMarcMilletScality

@JeanMarcMilletScality JeanMarcMilletScality commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

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.

Expected Before
Long label on hover one line wraps to two lines + icon shift

Before:
image

After:
image

Root cause

On hover, the overlay (.sc-sidebar) uses width: fit-content while staying position: relative, so its containing block is the collapsed wrapper (~sidebarWidth, ~46px). fit-content is 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, so fit-content expands 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

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>
@JeanMarcMilletScality

Copy link
Copy Markdown
Contributor Author

/approve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant