-
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
Selection change not triggered when focus changed to button #1397
Comments
Found another bug related to the 'selection-change' event. If you use the OSX spellcheck feature to correct the spelling of a word in the quill text editor the selection-change event stops firing. example here https://codepen.io/edmeehan/pen/GvmKyd?editors=1111 |
I found that reverting to release version 1.3.0 solved the selection-change issue for me. |
reverting to 1.3.0 did not solve it for me, but revering to 1.2.6 did. |
@edmeehan-tcg The spellcheck issue seems to be related to #1654 and fixed by the same fix for it. |
This is happening because replaced elements can't have selection. So Note in the button example, Quill does have selection but not focus. I ran into a similar issue when clicking a div with Since focus state can change independently from selection state, it looks like there's no way around it - Quill might have to add listeners for |
Also, the work-around for this is: quill.root.addEventListener('blur', e => quill.setSelection(null)); |
Error still occurs, chearon work-around is fixing it |
Steps for Reproduction
quill.on('selection-change', (...args) => console.log(args));
to playground JSExpected behavior:
When clicking on a button, editor is blurred, triggering a selection-change event with
null
as the new selection.Actual behavior:
The editor loses focus (it's no longer the active element), but there's no selection-change event triggered.
I've tracked the problem down to
document.getSelection()
not being updated in either browser. Is this a browser bug? ShouldgetSelection
return the button content or something like that? If not, then I think Quill should special-case the 'blur' event to ensure that the event is accurately fired. If it is a bug, I'll file it, maybe in the meantime Quill could still work around this issue with the mentioned check?Platforms:
Ubuntu 16.10, Firefox 52.0.4 and Chrome 57.0.2987.98
Version:
Quill version 1.2.3
The text was updated successfully, but these errors were encountered: