-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Multi-Selection: Pressing escape resets focus #5524
Comments
Tested during today's accessibility bug-scrub and it still happens, though the focus loss is less evident now (because the More Options button gets focused and pressing Escape keeps focus in place in modern browsers). However, focus it still not moved back to the original insertion point or selected block. |
It may be an open question as to whether Escape should trigger a deselection at all. If multi-selection is meant to behave similar to a native input uncollapsed selection (e.g. in this GitHub "Write" textarea), then Escape has no assigned behavior. What do you think @afercia ? |
Tested with NVDA/Firefox 10/16 and this mostly works in the way described as 'expected' above, with focus moving back to selection start - except that you need to press escape twice before it takes effect. Without NVDA, it works with a single press of the key. I'm not sure whether escape should trigger this behavior; I'm not aware of any other contexts where escape alone deselects text. I'm not sure it's a problem, since the escape key doesn't have another expected purpose in this context. In Word, you can deselect blocks of text using escape plus left-arrow, so this is similar. Also in Word (and many other text editing contexts) you can deselect text by changing the cursor position. This isn't available from the keyboard when you have blocks selected, so having a keyboard accessible way to do this makes some sense. |
Worth noting in Safari, pressing Escape produces the same JS Selection is lost in Safari, thus the error. I'd guess the same happens in IE11. @aduth wouldn't be possible to consider to store the selection values somewhere and then use them? Adding the "bug" label, as I guess Gutenberg shouldn't produce JS errors. |
Yeah, I think so. One of the changes included in #10529 is to shift from checking selection at time of focus-out to instead track it when focus is shifted.
Isn't the bug tracked by #6165 already, this one merely a casualty of it? |
Thanks for clarifying. Sure, OK about the label. |
I can confirm that this is still reproducible. Screen.Capture.on.2022-07-26.at.17-01-47.mp4 |
I have an open PR in #48904 that tries dropping the user back to the block at the beginning of the selection when pressing Escape with multiple blocks selected in the editor canvas. |
Resolved in #48904 Feel free to reopen if I've missed any nuances not covered by that PR, though! |
Steps to reproduce:
Expected:
Focus (and block selection) moves back to selection start.
Actual:
Multi-selection is cleared, but focus is reset to the body.
The text was updated successfully, but these errors were encountered: