Skip to content

fix(Sidebar): center item icons when collapsed - #830

Draft
NagariaHussain wants to merge 1 commit into
frappe:mainfrom
NagariaHussain:fix/sidebar-item-collapsed-centering
Draft

fix(Sidebar): center item icons when collapsed#830
NagariaHussain wants to merge 1 commit into
frappe:mainfrom
NagariaHussain:fix/sidebar-item-collapsed-centering

Conversation

@NagariaHussain

@NagariaHussain NagariaHussain commented Jul 10, 2026

Copy link
Copy Markdown
Member

Problem

When the sidebar is collapsed, item icons sit hard left in the rail instead of centered, and the active item's pill shows a large empty area to the right of the icon.

The label span keeps flex-1 in the collapsed state. Its flex-basis: 0% takes precedence over w-0, so the grow factor expands the invisible label to fill the row — justify-center on the link has no free space left to center in.

Solution

Apply flex-none to the label span when collapsed (and flex-1 only when expanded), so the hidden label truly collapses to zero width and the icon centers in the rail.

Before After
Icon left-hugged, empty pill space right Icon centered, compact pill

🤖 Generated with Claude Code

https://claude.ai/code/session_012PXJnZXUyt5vyE7DiuLnD3

Coverage: 68.82% (±0.00% vs main)

The label span kept flex-1 in the collapsed state, and its flex-basis of
0% takes precedence over w-0 — the grow factor expanded the invisible
label to fill the row, pushing the icon hard left and leaving a large
empty area inside the active pill. Swap to flex-none when collapsed so
justify-center can actually center the icon in the rail.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012PXJnZXUyt5vyE7DiuLnD3
@netchampfaris

Copy link
Copy Markdown
Contributor

@NagariaHussain screenshots?

@NagariaHussain

Copy link
Copy Markdown
Member Author

It is not ready for review yet, hence in draft 😅

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.

2 participants