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): select all per {Control}+[KeyA] #774

Merged
merged 3 commits into from
Nov 11, 2021
Merged

Conversation

ph-fritsche
Copy link
Member

@ph-fritsche ph-fritsche commented Nov 3, 2021

What:

Select all per key combination.

Why:

Default behavior in the browser.

How:

Add a behaviorPlugin for keydown on {Control>}[KeyA].

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

Additional information
This requires proper handling of selection ranges.

// TODO: properly handle selection ranges

Renders our implementation of userEvent.keyboard('{selectall}') obsolete which allows to remove the only specialChar and behaviorPlugin that has no corresponding behavior in the browser.
Also allows us to replace the implementation of userEvent.clear().

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 3, 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 a598fee:

Sandbox Source
userEvent-PR-template Configuration

@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Nov 3, 2021
@codecov
Copy link

codecov bot commented Nov 11, 2021

Codecov Report

Merging #774 (a598fee) into alpha (9273c8a) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             alpha      #774   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           64        66    +2     
  Lines         1384      1394   +10     
  Branches       544       549    +5     
=========================================
+ Hits          1384      1394   +10     
Impacted Files Coverage Δ
src/keyboard/plugins/index.ts 100.00% <ø> (ø)
src/keyboard/plugins/combination.ts 100.00% <100.00%> (ø)
src/utils/focus/selectAll.ts 100.00% <100.00%> (ø)

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 9273c8a...a598fee. Read the comment docs.

@ph-fritsche ph-fritsche marked this pull request as ready for review November 11, 2021 10:18
@ph-fritsche ph-fritsche changed the title feat(keyboard): select all per [Ctrl]+[A] feat(keyboard): select all per {Control}+[KeyA] Nov 11, 2021
@ph-fritsche ph-fritsche merged commit e715c81 into alpha Nov 11, 2021
@ph-fritsche ph-fritsche deleted the feat-selectAll branch November 11, 2021 14:58
@github-actions
Copy link

🎉 This PR is included in version 14.0.0-alpha.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ph-fritsche
Copy link
Member Author

See #778 (comment)
This behavior is triggered by Cmd+A on Mac. Maybe this should be made configurable like the keyboardMap in the future.

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.

1 participant