-
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
Don't allow access to Styles-related pages via the command palette in the hybrid theme #53123
Conversation
Size Change: +80 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in 9b15f6c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5694020446
|
I have discovered that relying on the current Update: Based on this comment, it appears that this problem can be solved by using |
9b15f6c
to
ebf53bc
Compare
Do you have an example of a hybrid theme? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
I didn't test the "hybrid theme" case though.
Thanks for the review! I think you can access |
As far as I have tested, it is working as expected in the hybrid theme, so I would like to merge it 🙂 |
Part of #52154
What?
This PR prevents two style-related pages from being accessible via the command palette in a classic theme that supports
block-template-parts
.As a result, unintended page transitions and canvas rendering in the site editor will be fixed.
f0c768dd61ba4a8ca41e082ca1e2e73a.mp4
Why?
At least at this time, global styles are not available for non-block themes. However, my understanding is that useCommonCommands is also executed when a non-block theme accesses the template parts page. This results in two unintended commands being registered by useCommand.
How?
I started by splitting the
useIsSiteEditorAccessible()
hook introduced in #52987 into the following two hooks:useIsTemplatesAccessible()
useIsBlockBasedTheme()
And to conditionally execute the command, I used
useCommandLoader()
instead ofuseCommand()
. In addition, use the newly addeduseIsBlockBasedTheme()
hook and change these two commands to do nothing if it is not a block theme.Testing Instructions
In the classic theme (TT1), the hybrid theme (EmptyHybrid) and the block theme (TT3), confirm that all commands affected by this PR work as expected.
Classic Theme
Hybrid Theme
Block Theme
Next Step
I have further confirmed that the page menu in the Site Editor is also unintentionally accessible. This will be addressed in a future PR.