Skip to content

[CLOV-139] Fix focus indicator for keyboard navigation#4217

Open
Morten Sorth (MortenSorth) wants to merge 7 commits intomainfrom
MortenSorth/backpack-setup
Open

[CLOV-139] Fix focus indicator for keyboard navigation#4217
Morten Sorth (MortenSorth) wants to merge 7 commits intomainfrom
MortenSorth/backpack-setup

Conversation

@MortenSorth
Copy link

@MortenSorth Morten Sorth (MortenSorth) commented Feb 5, 2026

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:

  • Added position: relative and display: block for proper layout
  • Added :focus state using the standard bpk-focus-indicator mixin

Browser Notes

  • Chrome/Firefox: Works out of the box
  • Safari: Requires "Press Tab to highlight each item on a webpage" to be enabled in Safari > Settings > Advanced (this is standard Safari behavior for link focus)

Testing

Verified focus indicator works correctly in:

  • Chrome ✓
  • Firefox ✓
  • Safari ✓ (with tab highlighting setting enabled)

  • Ability to navigate using a keyboard only
  • Zoom functionality - focus indicator scales appropriately
  • Screen reader compatibility - no breaking changes to DOM structure

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>
Copilot AI review requested due to automatic review settings February 5, 2026 14:49
@MortenSorth Morten Sorth (MortenSorth) added the patch Patch production bug label Feb 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-radius to link elements to ensure focus outline follows the card shape
  • Implemented :focus-visible state using the bpk-focus-indicator mixin for keyboard navigation feedback

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MortenSorth Morten Sorth (MortenSorth) changed the title [BpkContentCards] Add focus visible indicator for keyboard navigation [Clov-139] Add focus visible indicator for keyboard navigation Feb 5, 2026
@skyscanner-backpack-bot
Copy link

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>
@MortenSorth Morten Sorth (MortenSorth) changed the title [Clov-139] Add focus visible indicator for keyboard navigation [BpkContentCards] Fix focus indicator for keyboard navigation Feb 6, 2026
@skyscanner-backpack-bot
Copy link

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>
@skyscanner-backpack-bot
Copy link

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>
@skyscanner-backpack-bot
Copy link

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>
@skyscanner-backpack-bot
Copy link

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>
@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4217 to see this build running in a browser.

@MortenSorth Morten Sorth (MortenSorth) changed the title [BpkContentCards] Fix focus indicator for keyboard navigation [CLOV-139] Fix focus indicator for keyboard navigation Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Patch production bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant