-
Notifications
You must be signed in to change notification settings - Fork 152
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
when editor element is blurred but has selection, still possible to insert text #285
Milestone
Comments
bantic
added a commit
that referenced
this issue
Jan 11, 2016
This helps prevent a situation where the editor element has a selection but it is not the active element. Typing while another element (like a button) is focused (active) but the editor element has the selection is problematic: The browser refocuses on the editor element and starts inserting text, but it handles the input before it has focused, which means the key* handlers do not fire. Also renamed Position#emptyPosition and Range#emptyRange -> blankPosition, blankRange. Adds `isBlank` property to Position and Range. Defensively avoid attempting to render a cursor when the range is blank. Fixes #285
bantic
added a commit
that referenced
this issue
Jan 11, 2016
This helps prevent a situation where the editor element has a selection but it is not the active element. Typing while another element (like a button) is focused (active) but the editor element has the selection is problematic: The browser refocuses on the editor element and starts inserting text, but it handles the input before it has focused, which means the key* handlers do not fire. Also renamed Position#emptyPosition and Range#emptyRange -> blankPosition, blankRange. Adds `isBlank` property to Position and Range. Defensively avoid attempting to render a cursor when the range is blank. Fixes #285
bantic
added a commit
that referenced
this issue
Jan 11, 2016
This helps prevent a situation where the editor element has a selection but it is not the active element. Typing while another element (like a button) is focused (active) but the editor element has the selection is problematic: The browser refocuses on the editor element and starts inserting text, but it handles the input before it has focused, which means the key* handlers do not fire. Also renamed Position#emptyPosition and Range#emptyRange -> blankPosition, blankRange. Adds `isBlank` property to Position and Range. Defensively avoid attempting to render a cursor when the range is blank. When cursor contains non-markerable, toggleMarkup is no-op Fixes #285 Fixes #287
mixonic
pushed a commit
to mixonic/content-kit-editor
that referenced
this issue
Jan 22, 2016
This helps prevent a situation where the editor element has a selection but it is not the active element. Typing while another element (like a button) is focused (active) but the editor element has the selection is problematic: The browser refocuses on the editor element and starts inserting text, but it handles the input before it has focused, which means the key* handlers do not fire. Also renamed Position#emptyPosition and Range#emptyRange -> blankPosition, blankRange. Adds `isBlank` property to Position and Range. Defensively avoid attempting to render a cursor when the range is blank. When cursor contains non-markerable, toggleMarkup is no-op Fixes bustle#285 Fixes bustle#287
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the
document.activeElement
is an element outside the editor's element butwindow.getSelection()
is within the editor's element, subsequent keystrokes will refocus onto the editor element and insert text, but they will not fire event handlers that were registered on the element. This causes issues related to inserting text in places it shouldn't go, such as around a card.To reproduce in the demo:
activeElement
is the button that was clicked), but since the selection is still in the (contenteditable) editor element, the text will be inserted:The text was updated successfully, but these errors were encountered: