Skip to content

fix: keyboard event repeat property - #1312

Merged
snowystinger merged 2 commits into
testing-library:mainfrom
snowystinger:support-repeat-events
Aug 11, 2026
Merged

fix: keyboard event repeat property#1312
snowystinger merged 2 commits into
testing-library:mainfrom
snowystinger:support-repeat-events

Conversation

@snowystinger

Copy link
Copy Markdown
Contributor

What

Closes Keyboard: Press and hold for X events does not set the 'repeated' attribute

Why

I was unable to test repeat key enabled handlers in our repo. fix: all keyboard repeat events for navigation
I was writing sequences like

fireEvent.keydown(document.activeElement, {key: 'a'});
fireEvent.keydown(document.activeElement, {key: 'a', repeat: true});
fireEvent.keyup(document.activeElement, {key: 'a'});

How

When the key has not been released and has fired more than 1 event, it includes the repeat property set to true.

Checklist

  • Documentation
  • Tests
  • Ready to be merged

The documentation already says it handles repeat keys. It was unexpected that it didn't set the property.

@snowystinger snowystinger changed the title fix keyboard event repeat property fix: keyboard event repeat property Aug 11, 2026
@snowystinger
snowystinger merged commit d7e80e3 into testing-library:main Aug 11, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

馃帀 This PR is included in version 14.6.4 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard: Press and hold for X events does not set the 'repeated' attribute

1 participant