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

fix(Dropdown): fix handling of "Space" key #4041

Merged
merged 2 commits into from
Aug 19, 2020
Merged

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Aug 19, 2020

Fixes #3146.
Fixes #3689.


This PR moves the handling of Spacebar to Dropdown's scope instead of the global scope with EventListener. In any case these events should handled only when Dropdown is focused.

Another noticeable change is handling of Spacebar in openOnSpace(): now we will call preventDefault() only when e.target is non-editable element and needs to prevent default behavior to avoid scrolling.

@github-actions
Copy link

size-limit report

Path Size
bundle-size/dist/Button.size.js 66.39 KB (0%)
bundle-size/dist/Icon.size.js 30.58 KB (0%)
bundle-size/dist/Image.size.js 61.63 KB (0%)
bundle-size/dist/Modal.size.js 76.65 KB (0%)
bundle-size/dist/Portal.size.js 47.78 KB (0%)

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2020

Codecov Report

Merging #4041 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4041   +/-   ##
=======================================
  Coverage   99.84%   99.84%           
=======================================
  Files         183      183           
  Lines        3276     3280    +4     
=======================================
+ Hits         3271     3275    +4     
  Misses          5        5           
Impacted Files Coverage Δ
src/modules/Dropdown/Dropdown.js 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 e8d07f9...58d7252. Read the comment docs.

@layershifter layershifter merged commit 1c24915 into master Aug 19, 2020
@layershifter layershifter deleted the fix/dropdown-space branch August 19, 2020 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants