-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Writing flow: fix vertical arrow keys not moving #53454
Conversation
Size Change: +17 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
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!
From what I have been able to find, this problem also occurs in browsers other than Safari and seems to be affected by the initial cursor position, browser size, amount of scrolling, etc. I have also observed the problem not only with vertical but also horizontal movement.
For example, in my environment, I observed at least the following problems in trunk:
Chrome: get stuck when moving down
Screencast
chrome_vertical_down.mp4
Chrome: get stuck when moving right
Screencast
chrome_horizontal.mp4
Firefox: get stuck on both upward and downward movement
Screencast
firefox_vertical.mp4
I have tried various scenarios with this PR and everything seems to work as expected without stacking, both vertically and horizontally 🎉
chrome_result.mp4
Awesome! Yes, it seems like sometimes it works in Chrome, and sometimes is doesn't. I noticed it often gets stuck when the container is exactly aligned with the scroll container viewport 🤔 |
What?
Fixes #44055. Sometimes vertical arrow keys get stuck when the container edge is out of view.
Why?
How?
The problem lies in
isVerticalEdge
wheredocument.caretRangeFromPoint
can not get a Range in some browsers because it's out of view. The solution is to scroll the container into view like we do forplaceAtEdge
.Testing Instructions
Vertical arrow key in Safari
Testing Instructions for Keyboard
Screenshots or screencast