-
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
Select Mode: Blocks outside the main sections root should be disabled #65518
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +41 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
// Blocks outside sections should be disabled. | ||
const isWithinSectionRoot = isWithinBlock( | ||
state, | ||
clientId, | ||
sectionRootClientId | ||
); |
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.
Do we also want to do this in zoom-out
mode? I'd say we might well.
Aside: this is why maintaining x2 similar modes during the 6.7 release cycle is going to be tricky.
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.
What if we just change the condition to if [ "zoom-out", "navigation" ].includes( editorMode )
(until we remove zoom-out)
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.
Here are the two differences that exist with zoom-out today:
- The root container is "default" in "navigation" but "contentOnly" in zoom-out.
- Zoom-out doesn't enable "content blocks", everything is disabled within sections.
Do we want to unify that?
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.
Given that currently zoom-out disables everything that is not a section, the bug covered by this PR is actually already covered by "zoom-out" but if we change zoom-out to enable editing "content " blocks, then we'll have the same issue. So for now, it seems safe to move forward.
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.
Thank you 🙇♂️
I think Zoom Out has a similar requirement. In #65145 the reporter is noting that blocks outside the section root aren't editable. |
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.
This fixes the problem and the comments and tests are great!
Related #60021
What?
I noticed a bug where sometimes in "select mode" some random content blocks remain editable even if they don't belong in the "main" section. For instance in 2024, you can see that you can check the text of some menu items in the footer while editing the home page template in select mode.
This bug led me to do a small refactoring to the
getBlockEditingMode
function, added some comments and also added unit tests to cover all the "navigation mode" use-cases.Testing Instructions
1- Open 2024 home page template
2- Pick the "select tool" (or edit mode)
3- Check that you can't edit random text in the footer.