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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(type): ensure the selectionStart/End are consistent with browsers #322

Merged
merged 3 commits into from Jun 8, 2020

Conversation

kentcdodds
Copy link
Member

@kentcdodds kentcdodds commented Jun 8, 2020

What: fix(type): ensure the selectionStart/End are consistent with browsers

Why:

Closes: #321
Closes: #318
Closes: #316

How:

Investigated how the browser deals with situations where values are changed programmatically: https://jsbin.com/decutel/3/edit?html,js,output

The rule is: If the value changes to something that it would not have naturally from the user's input, then send the selection range to the end.

Because we're programmatically changing it, the browser automatically sends the selection range to the end, so we have to correct for that by moving the selection range back to where it would be (if the value doesn't change from what we expected after we fire the input event).

And this is why people use userEvent 馃槈

Checklist:

  • Documentation N/A
  • Tests
  • Typings
  • Ready to be merged

@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #322 into master will decrease coverage by 0.64%.
The diff coverage is 86.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #322      +/-   ##
==========================================
- Coverage   99.32%   98.68%   -0.65%     
==========================================
  Files           2        2              
  Lines         298      305       +7     
  Branches       76       79       +3     
==========================================
+ Hits          296      301       +5     
- Misses          2        4       +2     
Impacted Files Coverage 螖
src/type.js 98.40% <86.66%> (-1.60%) 猬囷笍

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 b62dc68...270240d. Read the comment docs.

@kentcdodds kentcdodds merged commit a44b14a into master Jun 8, 2020
@kentcdodds kentcdodds deleted the pr/fix-type-again branch June 8, 2020 18:06
@kentcdodds
Copy link
Member Author

馃帀 This PR is included in version 11.3.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
1 participant