-
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
IE11: browser crashes on pressing Enter to switch to edit mode #21276
Comments
Crashes on pasting too (Ctrl + V and Paste menu), in WP 5.4. Seems to come from here:
This remains the same in the built file, but IE11 only supports Changing this to |
@azaozz Do you suspect it's the same issue for the original report? It would seem to be, based on the error message.
Mentioned in Slack as well (link requires registration), since I sense there's a few ways we could accommodate this. To me, it might just be simplest to bypass let parent = node;
while ( ( parent = parent.parentNode ) ) {
if ( parent.nodeType === Node.ELEMENT_NODE && parent.nodeName === 'PRE' ) {
return;
}
} |
Tested only with pasting in the block editor in WP 5.4, but here is a similar use of
Yep, sounds good. The |
For what it's worth, if we had type-checking enabled for Edit: Though, this one may be more about how a parent may not exist, not necessarily the behavior of IE. Still an issue, though one we might have been "okay" to let through in the case of assuming the candidate as having a parent. |
The issue from the original comment is that we're passing
gutenberg/packages/block-editor/src/utils/dom.js Lines 59 to 60 in 4b8d1f8
It is important to note that
https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/activeElement This varies by browser implementation. Unsurprisingly, Internet Explorer is one such browser where This is a nearly identical problem as in #20594. The solution could be one of two approaches:
Separately, given that there have been multiple instances of this issue, I would suggest we consider to create some new utility to normalize the behavior of Example: function getActiveElement() {
return document.activeElement && document.activeElement !== document.body
? document.activeElement
: null
} |
@azaozz Is there anything special about the type of text you're trying to paste (e.g. HTML formatted, etc)? I'm having trouble reproducing the crash. |
Oh, I see now. I was expecting a crash. It "just" errors, and doesn't paste. I can reproduce now, at least 👍 |
Ah, sorry, not really a crash :) |
That would be best imho. Also seeing some "jumpiness" when clicking in the classic block that might be related. |
Fix for #21276 (comment) is at #21366. |
On reflection, a |
Describe the bug
On IE11, with a block selected and with the editor in select mode, pressing Enter to switch to edit mode causes the editor to crash with the following error message:
The console also reports:
To reproduce
Steps to reproduce the behavior:
Expected behavior
Expected all keyboard shortcuts to work correctly.
The text was updated successfully, but these errors were encountered: