Skip to content

fix keyboard event repeat property#1312

Open
snowystinger wants to merge 1 commit into
testing-library:mainfrom
snowystinger:support-repeat-events
Open

fix keyboard event repeat property#1312
snowystinger wants to merge 1 commit 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.

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.

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

1 participant