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: selectOptions #543

Merged
merged 4 commits into from Jan 21, 2021
Merged

fix: selectOptions #543

merged 4 commits into from Jan 21, 2021

Conversation

ph-fritsche
Copy link
Member

What:

These changes fix bugs on selectOptions.

Why:

  1. selectOptions failed to trigger correct events on options with role attribute. - see selectOptions fails on options with role attribute #542
  2. selectOptions missed pointer events that happen when selecting an option of regular <select>.
  3. selectOptions made the false assumption the browser would change aria-selected attributes when clicking an element with role="option".

See https://codesandbox.io/s/user-event-changle-handler-with-role-forked-d5ubs?file=/src/LoggingSelects.js for tracking events that actually happen in the browser.

How:

  1. Decide which event pattern to follow based on element type of the listbox instead of role attribute of the option.
  2. Add the pointer events observed in the browser.
  3. Move event handling into utility component and fix the EventSnapshot.

Checklist:

  • Tests
  • Ready to be merged

@codecov
Copy link

codecov bot commented Jan 11, 2021

Codecov Report

Merging #543 (dfec809) into master (6c21e1f) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #543   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          675       684    +9     
  Branches       211       212    +1     
=========================================
+ Hits           675       684    +9     
Impacted Files Coverage Δ
src/select-options.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 6c21e1f...dfec809. Read the comment docs.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Thanks 👏

@kentcdodds kentcdodds merged commit 6a02a14 into master Jan 21, 2021
@kentcdodds kentcdodds deleted the fix-542 branch January 21, 2021 14:19
@github-actions
Copy link

🎉 This PR is included in version 12.6.1 🎉

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.

None yet

2 participants