-
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
Try advanced heuristic to "detect" the best Section Root in Themes #67113
base: trunk
Are you sure you want to change the base?
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: +92 B (+0.01%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
I think improving the heuristic is awesome, there certainly are cases when the main group does not exist but there could be an obvious section group. The situation where there is nowhere to drop a pattern - particularly since we went fast and entered zoom out on pattern inserter - is mitigated often by this PR. However half of the problem is where the theme layout is not friendly to vertical section stacking style for page building. Both examples in the PR description are good examples where the UX is completely bad, there is no way to know where "content" should live in those layouts while scaling is applied. In design mode at least there is no amount of space suggesting it's empty! I will risk and propose that can we not have the pattern building tied to scaled out view if there is no detected section root? |
I think that's totally valid. I think perhaps we discussed before that trying to be too clever could tie us in knots. I say (in order of priority):
|
Here is the PR to Disable Zoom Out if the section root doesn't exist: We now need to decide whether we want to explore being "clever" about trying to detect the section root or not. |
f235b20
to
be3b918
Compare
What?
Refines the algorithm for determining the section root to include common patterns found in Themes.
Closes #65400
Why?
Currently the algorithm optimises solely for a Group block with a
<main>
tag. That's pretty restrictive and many Themes don't optimise for this...yet.We need to include common patterns found in Themes.
How?
Seeks the root in the following in order of priority:
<main>
tag - this can be anywhere in the block hierarchy.Note I intentionally ommitted other types of "container" block such as 👍
This is because these blocks do not behave well with drop zones in this experience.
As a result for anything other than Group we will treat the root of the editor as the root. This means if the Theme chooses to use a Columns block as the root then in Zoom Out you will be able to insert content before/after the Columns but not within them.
Testing Instructions
Easiest to test using Playground.
<main>
in an unusual location. Resetting the<main>
tag to default will be best when testing.Testing Instructions for Keyboard
Screenshots or screencast