-
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
Nonfatal error tabbing away from preview frame in Site Editor #69037
Comments
The error is in the |
Hi, @stokesman
which in my case solved the issue. Let me know your thoughts. Screen.Recording.2025-02-05.at.10.20.31.AM.mov |
@singhakanshu00, while that would fix the symptom, that doesn't fix the root cause @stokesman mentions here. Sometimes, it's okay to fix errors with optional chaining, but generally, fixing the root cause of the issues should be preferred. |
I identified this issue as being caused by #65204. This PR contains a lot of code changes, but it would be a good idea to investigate why It may not be an urgent issue, but let's see if we can fix it in WP 6.8. |
It turns out there is at least one other closely related issue with the preview frame focus and keyboarding. The "Select All" shortcut is active in preview mode (screen recording disclosed)site-editor-preview-unintended-keyboard-editable.mp4I’ll see about making an issue/PR for that. I mention it here because the fix I have in mind would avoid/obscure this issue and I think pinpointing the cause, per Aki’s last comment, would be ideal. |
Here’s what I’ve gleaned. In the context of the Site editor and the preview canvas, the I confirmed this by testing after making it return early for the same conditions: diff --git a/packages/block-editor/src/components/writing-flow/use-tab-nav.js b/packages/block-editor/src/components/writing-flow/use-tab-nav.js
index 46c40d56fe..83063ee9e3 100644
--- a/packages/block-editor/src/components/writing-flow/use-tab-nav.js
+++ b/packages/block-editor/src/components/writing-flow/use-tab-nav.js
@@ -111,7 +111,10 @@ export default function useTabNav() {
const ref = useRefEffect( ( node ) => {
function onKeyDown( event ) {
- if ( event.defaultPrevented ) {
+ if (
+ event.defaultPrevented ||
+ ( ! hasMultiSelection() && ! getSelectedBlockClientId() )
+ ) {
return;
}
|
@stokesman Thank you for your research.
This diff looks like it works fine for me. Do we submit a PR and see if it passes CI? |
I will open up a PR to run the tests, it seems to be working fine with the diff. |
Description
In the Site editor tabbing away from the preview frame causes an error. I expect it to be error free.
This doesn’t happen in 6.7.1 without Gutenberg plugin. I'm not sure if the latest Gutenberg plugin releases have this issue or not.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
site-editor-tab-away-from-preview-error.mp4
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: