-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
DOM mutation observer refocuses the editor preventing Tab navigation #1404
Comments
Thanks so much for this fix @jhchen. Can you publish this update to npm so we can pickup this fix at Slack? |
Yes I will later today but want to get a couple other bug fixes in. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At Slack we're using the focus-ring library to style focus when the user navigates using the keyboard. The focus-ring library binds
focus
andblur
event listeners used to add and remove afocus-ring
class from the event target. Unfortunately, once you navigate into a Quill editor using the Tab key, you cannot navigate out by pressing Tab as a result of Quill re-focusing the editor in response to DOM mutation. (Specifically, Quill currently callssetNativeRange()
in response to a mutation event.)Here's the breakdown of the the sequence of events:
blur
event the focus-ring library removes thefocus-ring
class from the editor's contenteditable<div>
.Parchment
'sScrollBlot
is called, which in turn callsupdate()
update()
emits a 'scroll-before-update' event.setNativeRange()
method.setNativeRange()
focuses the editor if it doesn't already have focusSteps for Reproduction
Expected behavior:
You should be able to press Tab to exit the editor.
Actual behavior:
Re-focusing the editor in response to the DOM mutation (class name removal) prevents the user from navigating out via the Tab key.
Platforms:
Chrome on Mac and Windows (and likely Linux, but wasn't able to test on Linux)
Version:
1.2.3
The text was updated successfully, but these errors were encountered: