Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(keyboard): apply modifier state #815

Merged
merged 3 commits into from
Dec 30, 2021
Merged

feat(keyboard): apply modifier state #815

merged 3 commits into from
Dec 30, 2021

Conversation

ph-fritsche
Copy link
Member

@ph-fritsche ph-fritsche commented Dec 28, 2021

What:

Apply modifier state. See https://www.w3.org/TR/uievents/#dom-keyboardevent-getmodifierstate

Why:

Closes #812

How:

Keep track of modifier states on keyboardState.
Apply modifier states on keyboard and pointer events.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

Additional information:

In the browser e.g. getModifierState('Shift') returns true if shiftKey: true is set on the EventInit.
In Jsdom getModifierState is implemented for e.g. modifierCapsLock but fails for Alt, Control, Meta and Shift.

@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Dec 28, 2021
@ph-fritsche ph-fritsche linked an issue Dec 28, 2021 that may be closed by this pull request
@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 28, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit bb843bc:

Sandbox Source
userEvent-PR-template Configuration

@codecov
Copy link

codecov bot commented Dec 28, 2021

Codecov Report

Merging #815 (bb843bc) into beta (684451f) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              beta      #815   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           77        79    +2     
  Lines         1572      1578    +6     
  Branches       556       559    +3     
=========================================
+ Hits          1572      1578    +6     
Impacted Files Coverage Δ
src/keyboard/index.ts 100.00% <ø> (ø)
src/keyboard/keyMap.ts 100.00% <ø> (ø)
src/keyboard/plugins/index.ts 100.00% <ø> (ø)
src/utils/pointer/firePointerEvents.ts 100.00% <ø> (ø)
src/keyboard/keyboardAction.ts 100.00% <100.00%> (ø)
src/keyboard/plugins/character.ts 100.00% <100.00%> (ø)
src/keyboard/plugins/combination.ts 100.00% <100.00%> (ø)
src/keyboard/plugins/functional.ts 100.00% <100.00%> (ø)
src/keyboard/plugins/modifiers.ts 100.00% <100.00%> (ø)
src/utils/keyboard/getKeyEventProps.ts 100.00% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 684451f...bb843bc. Read the comment docs.

@ph-fritsche ph-fritsche merged commit e9635f6 into beta Dec 30, 2021
@ph-fritsche ph-fritsche deleted the fix-812 branch December 30, 2021 07:28
@github-actions
Copy link

🎉 This PR is included in version 14.0.0-beta.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UIEvent modifiers per getModifierState
1 participant