Skip to content

Conversation

@Kamalllx
Copy link

Closes #33025

What I did

Added visible :focus-visible styles for interactive elements (links, buttons, inputs, textareas, and selects) within the Docs view to ensure keyboard focus indicators are visible when navigating with Tab/Shift+Tab.

Changes:

  • Added a new style rule in DocsPage.tsx that applies a 2px solid outline using the theme's secondary color to all interactive elements when focused via keyboard
  • Included outline-offset: 2px for better visual separation
  • Added fallback support for high-contrast/forced-colors environments using @media (forced-colors: active)

This fix improves accessibility compliance with WCAG 2.1.1 (Keyboard) and WCAG 2.4.7 (Focus Visible).

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  1. Run a sandbox: yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Open Storybook in your browser at http://localhost:6006
  3. Navigate to any story's Docs view
  4. Use the Tab key to navigate between interactive elements (links, buttons, "Show code", "Copy" buttons)
  5. Verify that each focused element displays a visible outline (2px solid border)
  6. Test with both light and dark themes

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

…view

Closes storybookjs#33025

Added :focus-visible styles for interactive elements (a, button, input, textarea, select) in DocsPage.tsx to ensure keyboard focus indicators are visible. Includes fallback for high-contrast/forced-colors environments.
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.

[Bug]: Missing focus outline when navigating between components in Docs view

1 participant