Skip to content

Fix keyboard activation when using prefetch: 'click'#2538

Merged
pascalbaljet merged 5 commits intomasterfrom
activation-key
Aug 22, 2025
Merged

Fix keyboard activation when using prefetch: 'click'#2538
pascalbaljet merged 5 commits intomasterfrom
activation-key

Conversation

@pedroborges
Copy link
Copy Markdown
Contributor

Keyboard activation (Enter/Space) isn't working for links using prefetch: 'click' because the click event handler prevented default behavior but didn't trigger the mousedown/mouseup events used for prefetching and navigation. Fixes #2274.

Without proper keyboard support, links become unusable for users with motor disabilities, screen reader users, and anyone who navigates with a keyboard.

I fixed this issue by adding:

  • keydown/keyup event handlers to mirror the existing mousedown/mouseup behavior
  • shouldActivateOnKey() to ensure Space only activates buttons (not links, per accessibility standards)
  • tests to verify keyboard activation works correctly

@pascalbaljet
Copy link
Copy Markdown
Member

Thanks!

@pascalbaljet pascalbaljet merged commit da899ea into master Aug 22, 2025
12 checks passed
@pascalbaljet pascalbaljet deleted the activation-key branch August 22, 2025 05:31
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.

Using link prefetching with 'click' option breaks accessibility

2 participants