Skip to content

fix(SideNav): center footer content in the collapsed rail - #4819

Open
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:rocky/issue-4807-sidenav-footer-collapsed
Open

fix(SideNav): center footer content in the collapsed rail#4819
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:rocky/issue-4807-sidenav-footer-collapsed

Conversation

@AKnassa

@AKnassa AKnassa commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Problem

When a SideNav is collapsed to its narrow rail, content passed through the children slot is centered — but content passed through the footer slot is not. It stretches to the rail's full width instead.

The two slots are structural twins: each has a "collapsed" style variant, but only the children one (scrollableCollapsed) sets alignItems: 'center'. The footer one (stickyBottomCollapsed) only zeroes padding, so its flex children fall back to the default stretch.

Fix

One line: stickyBottomCollapsed now sets the same alignItems: 'center' as its sibling, so footer content centers in the collapsed rail exactly like children content.

The footer row beneath it (collapse button + footer icons) already centered its own content, so nothing else moves — the only visible change is footer content narrower than the rail, which now centers instead of stretching.

Verification

Measured in a real browser (storybook CollapsibleSidebar story, collapsed rail 48px wide → 32px content box, footer probe = auto-width Badge):

Before After
sticky-bottom align-items normal (stretch) center
Badge width 32px (forced to full content box) ~24px (natural)
Badge position flush to both padding edges centered

One note for reviewers: the issue's exact repro (a width="100%" icon-only Button) renders identically before and after at rest, because width: 100% resolves to the same 32px content box under both stretch and center. The difference shows for any footer content that doesn't span the full width, and during transient width states (e.g. a resize drag).

  • New test renders a collapsed SideNav and asserts computed align-items: center on both slots — the children slot acts as the control, and the footer assertion fails without the fix.
  • packages/core suite: 5994/5994 pass; core typecheck, eslint, prettier clean.
  • Changeset included (@astryxdesign/core patch).

Fixes #4807

The collapsed variant of the sticky-bottom slot was missing the
alignItems: 'center' that the children slot's collapsed variant
already applies, so footer content stretched to the full rail
width instead of centering.

Fixes facebook#4807
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

@AKnassa is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 8, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Aug 8, 2026
@AKnassa
AKnassa marked this pull request as ready for review August 8, 2026 03:47
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

SideNav (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1858 -
Complexity N/A Very High (179) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] SideNav footer slot doesn't center content when collapsed (stickyBottomCollapsed missing alignItems)

1 participant