-
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
Disable Zoom Out if no section root to allow for Theme opt in #67232
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: +145 B (+0.01%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
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.
Rather than add these selectively throughout the codebase, it feels like it should be more of an editor-level option of enabling/disabling zoom levels.
Something like this? https://github.com/WordPress/gutenberg/pull/67245/files |
@jeryj I replied on your PR. |
Thanks for the feedback folks. If this is a route (forgive the pun) we want to go down then we could look into creating an editor level abstraction for this. However, in the interests of expediency I think we should check for the section root and see whether this PR resolves the problem. This is particularly true when the absence of section root is what is causing problems in Themes. @draganescu @jeryj Did you get a chance to test the PR to see whether it works? 🙏 |
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.
Bit of a drive by test 👋🏻
This is working as described for me:
Trunk
Kapture.2024-11-28.at.11.37.43.mp4
This PR
Kapture.2024-11-28.at.11.39.55.mp4
I also checked scenarios that trigger zoom out mode in trunk. Opening the patterns inserter doesn't open zoom out mode, but Styles > Browse styles still does.
Personally, I think that's okay since, arguably, it still allows one to observe style changes to the entire page at once.
Anyway, this LGTM but another sanity check would help given my lack of context.
Thank you!
The E2E fails seem related, though I haven't confirmed locally |
b4aad6f
to
36c367e
Compare
Yes. Ironically it was because the tests for Zoom Out didn't include a section root! |
I think we'll need to add these disable checks to the hooks as well because of course we sometimes enter Zoom Out programatically (e.g. when selecting the Will make some adjustments... |
bab6c18
to
3d6b933
Compare
@ramonjd If you get a chance to take another look at this that would be great. I'd like to get this over the line so it can ship in the next Gutenberg release 🙏 |
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.
Retested and still works as expected.
I kicked off the E2E tests again.
👍🏻
Test failures are legit again. Need to investigate. |
I've realised that this PR will disable Zoom Out mode in the Post Editor entirely. That's because there is no section root in that Editor. Personally I feel that's probably ok, but I'd be curious to see what others think. |
b3cd9e4
to
dc26c49
Compare
This one is consistently failing. Trying to replicate manually and so far I cannot. |
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.
I tried to find a way around the fails - they're related, you're right, but I can't also reproduce in the browser. 🤔
Thanks for helping with the tests @talldan - they had me a bit stumped yesterday. Admittedly, I'm easily stumped. |
* Disable toolbar and auto inserter behaviour if no section root * Remove useless coercion Co-authored-by: Ramon <[email protected]> * Remove more coercion copy/paste Co-authored-by: Ramon <[email protected]> * Add section root to Zoom Out e2e test * Add test coverage * Add some test coverage * Try e2e test fix by reverting all template part changes in Theme * Remove need to exit Zoom Out * Ensure a main tag * Update tests to expect the click-through behavior * Simplify selection --------- Co-authored-by: getdave <[email protected]> Co-authored-by: talldan <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: draganescu <[email protected]>
Cherry-picked for the 19.8 release in c86612b ✅ |
…ess#67232) * Disable toolbar and auto inserter behaviour if no section root * Remove useless coercion Co-authored-by: Ramon <[email protected]> * Remove more coercion copy/paste Co-authored-by: Ramon <[email protected]> * Add section root to Zoom Out e2e test * Add test coverage * Add some test coverage * Try e2e test fix by reverting all template part changes in Theme * Remove need to exit Zoom Out * Ensure a main tag * Update tests to expect the click-through behavior * Simplify selection --------- Co-authored-by: getdave <[email protected]> Co-authored-by: talldan <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: draganescu <[email protected]>
* Disable toolbar and auto inserter behaviour if no section root * Remove useless coercion Co-authored-by: Ramon <[email protected]> * Remove more coercion copy/paste Co-authored-by: Ramon <[email protected]> * Add section root to Zoom Out e2e test * Add test coverage * Add some test coverage * Try e2e test fix by reverting all template part changes in Theme * Remove need to exit Zoom Out * Ensure a main tag * Update tests to expect the click-through behavior * Simplify selection --------- Co-authored-by: getdave <[email protected]> Co-authored-by: talldan <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: draganescu <[email protected]>
Added the label in the hope of getting this backported to WP Minor release at some point. |
|
@getdave Also, ignore me. I didn't have my glasses on 😇 WP not Gutenberg. As you were. |
What?
Disable Zoom Out if no section root to allow for Theme opt in by defining a
<main>
Closes #65400
Why?
Because reports have been coming in that the block layout of some Themes isn't compatible with a good experience in Zoom Out.
How?
With this change if a
<main>
tag is not defined (or we're not editing a entity with acore/post-content
block) then Zoom Out will be disabled.This allows Themes to opt in to Zoom Out based on where they place a
<main>
tag. If no<main>
is defined then Zoom Out will not work.Testing Instructions
<main>
from templateTesting Instructions for Keyboard
Screenshots or screencast