-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Focus input when InputControl spinner arrows are pressed #29305
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
Conversation
|
Size Change: +5.38 kB (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
TestingBehaviors
Note: |
|
Thanks for testing @jeyip! I just realized that my version of Safari is 12.1.2 and https://caniuse.com/mdn-api_globaleventhandlers_onpointerdown says the pointer events aren't supported there. The newer version of react-use-gesture is all pointer events so apparently only supports Safari 13 and up. I don't know if Gutenberg has any policy for Safari support. |
jeyip
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to add unit tests for this?
jeyip
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ItsJonQ This looks reasonable to me, but it'd be awesome if you could double check this and make sure we're not missing anything obvious 🙂
jeyip
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me whenever we resolve all the comments 🚀
That's a great question. According to this doc, we support the last two versions |
I managed to test this in Safari 13.1 by way of Browserstack and gutenberg.run 😎 . The dragging feature worked there. Looks like the latest version is 14, so if my math is correct we can not sweat the lack of Safari 12 support (not that the lack of this feature actually busted anything). |
Good question. I think it might not be since it's pretty specific to Firefox. The relief should be, I think, that before too long all |
What if we didn't make the test firefox specific, simulated a mousedown event on the input field, spied on the With that being said, I think you bring up a good point with the introduction of G2 components. I think there's value in the unit test preventing this bug from being reintroduced, but, depending on the time horizon, I'm comfortable skipping it, especially if these components will be phased out. |
|
Thanks for the nudge @jeyip. I'd totally thought a test like that would never fail but it does indeed without the change in this PR. For minutiae, I couldn't see a way to spy on |
ItsJonQ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 from me! Thank you @stokesman !
I tested it in Chrome, Safari, and FF. The focus works for me.
However, there seems to be something odd with Safari + spinner for me.
I think it's the react-use-gesture library 🤔 .
If it helps, I believe these interaction issues will be resolved when we update these inputs with ones from the new Component System.
@sarayourfriend and I are getting closer to adding these input components.
As it relates to this issue, the new inputs use custom "spinners", which bypasses some of the different browser arrow interaction oddities. It also supports features like shift step jumping and incrementing/decrementing with "velocity" (going up/down the longer you hold it).
|
Everything looks good to me! Feel free to merge when ready @stokesman 🚀 Thanks again for the help with this 🙏 |
Fix #29271
This has been done before 4e7c772. It was removed in bf9f9e5. This brings it back (and makes sure the drag-to-adjust feature still works).
UPDATE: The drag-to-adjust feature is not working in Safari (versions <= 12) but is unrelated to this PR. Also with regards to Safari support:
Thanks @jeyip!
How has this been tested?
In Firefox, Chrome, and Safari, in the post editor, with a range control, clicking the up/down arrows of the number input before having focused the input. Also dragging the input field to adjust to ensure that still works.
Screenshots
Types of changes
Bug fix
Checklist: