[CLOV-139] Fix focus indicator for keyboard navigation#4217
[CLOV-139] Fix focus indicator for keyboard navigation#4217Morten Sorth (MortenSorth) wants to merge 7 commits intomainfrom
Conversation
Added focus-visible styling to content card links to ensure keyboard navigation has visible focus indication, improving accessibility for keyboard users. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes an accessibility issue by adding a visible focus indicator to content cards for keyboard navigation. Previously, users tabbing through content cards had no visual feedback about which card was focused.
Changes:
- Added
border-radiusto link elements to ensure focus outline follows the card shape - Implemented
:focus-visiblestate using thebpk-focus-indicatormixin for keyboard navigation feedback
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4217 to see this build running in a browser. |
- Add tabIndex={0} to anchor for Safari tab navigation support
- Use ::before pseudo-element with border for cross-browser focus indicator
- Add position: relative and display: block for proper layout
- Safari doesn't reliably support :focus-visible on anchors, so removed
the :focus:not(:focus-visible) rule that was hiding the indicator
Fixes accessibility issue where keyboard users couldn't see which
card was focused when tabbing through the component.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4217 to see this build running in a browser. |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4217 to see this build running in a browser. |
- Use ::before pseudo-element with border for cross-browser focus indicator - Add position: relative and display: block for proper layout - Safari requires "Press Tab to highlight each item on a webpage" setting to be enabled in Safari > Settings > Advanced Fixes accessibility issue where keyboard users couldn't see which card was focused when tabbing through the component. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4217 to see this build running in a browser. |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4217 to see this build running in a browser. |
Use the standard Backpack focus indicator mixin instead of custom pseudo-element approach. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4217 to see this build running in a browser. |
Description
Fixes an accessibility issue where content cards had no visible focus indicator when navigating via keyboard. Users were unable to tell which card was currently focused when tabbing through the component.
Changes
BpkContentCard.module.scss:
position: relativeanddisplay: blockfor proper layout:focusstate using the standardbpk-focus-indicatormixinBrowser Notes
Testing
Verified focus indicator works correctly in: