-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Text inputs shouldn't scroll the page when home/end is pressed in them initially #1519
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
|
Build successful! 🎉 |
|
Build successful! 🎉 |
LFDanLu
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.
Tested the story, confirmed that the fn + left/right (home/end) only scrolled the container if the cursor was already at the start/end, LGTM
ktabors
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.
The code change looks good and the behavior works as described.
I tried to figure out what other components might inherit this and that ones that did, numberfield and colorfield have their own custom behaviors.
TextArea does not have this behavior, should it? Should TextArea have it's own custom page up or page down behavior? I'm thinking of someone using one in a texteditor, but in that case that should handle it themselves, right?
|
Hmm, not sure if we should be doing this on all textfields... it goes against default browser behavior for inputs. Should this be for combobox specifically? |
|
@ktabors i see the same behavior in both https://jsfiddle.net/snowystinger/4cfehau3/9/ I see it as we either need to enable onKeyDown in ComboBox and NumberField or we need to put this preventDefault logic in all of them here's how our components currently behave same as native https://codesandbox.io/s/admiring-silence-wiq3z?file=/src/App.js |
|
@snowystinger I think with my comment about TextArea I was trying to figure out how our component should behave and if it would your change would change how TextArea works. |
ktabors
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.
LGTM not that it isn't waiting. :)
|
Closing as there are no issues reported about this and it goes against native. |
Closes #1463
✅ Pull Request Checklist:
📝 Test Instructions:
Go to new story
path=/story/textfield--in-a-scrolling-containerand place the cursor in the start/middle/end. Press Home/End key once and twice.If cursor is already at the start, Home will cause container scroll.
If cursor is already at the end, End will cause container scroll.
If cursor is anywhere else, cursor will move to the start or end when home or end is pressed, respectively. After that, a second tap will cause the container scroll.
🧢 Your Project: