Skip to content

Align Feature tab indicator to button widths#399

Open
thomasvaeth wants to merge 3 commits intostorybookjs:mainfrom
thomasvaeth:main
Open

Align Feature tab indicator to button widths#399
thomasvaeth wants to merge 3 commits intostorybookjs:mainfrom
thomasvaeth:main

Conversation

@thomasvaeth
Copy link
Copy Markdown

What

Fixes the active indicator line in the hero feature tabs, which was using hardcoded pixel offsets that didn't match the actual rendered button widths.

How

  • Replaced hardcoded left/width values with dynamic measurement via getBoundingClientRect() using a buttonRefs array
  • Indicator state initializes as null — on first render the active button uses box-shadow to avoid layout shift, then transitions to the measured indicator after the first useEffect
  • Added role="tablist", role="tab", and aria-selected to the desktop tab buttons

Before
Screenshot 2026-03-26 at 8 54 37 PM

After
Screenshot 2026-03-26 at 8 54 22 PM

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

👷 Deploy request for storybook-addon-catalog pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2c90a4f

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

👷 Deploy request for storybook-frontpage pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2c90a4f

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