-
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
Restores setting zoom out mode to useZoomOut hook #65999
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: +30 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
I thought we'd decided not to use that hook in the Patterns inserter? As I understood it, that hook was "zoom out" so should only handle zooming. But if it's being used everywhere as a proxy for toggling:
...then yes there will be bugs. Ideally this hook would have no existed because it exposes internal "modes" which can only be set by experimental actions. But if we are set on using it then it will need fixes here. |
I think that was decided before the requirements were clearer. I think the required behavior will need a hook or useEffect.
The intention of the hook was originally to set and unset modes, which is what is required to set zoom out mode when entering patterns and restoring the previous mode when exiting the inserter.
I think it should exist to support the desired UX, just not have been made public. |
Yes correct. This is what I meant to say 👍 |
If this is/was a public API then the hook should continue to do what it did in 6.6. So let's try to get this merged so we can have a stable experience. |
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 PR fixes the bug where entering zoom out view via the patterns tab does not set the selection mode, it remains in design.
@@ -1077,11 +1077,11 @@ _Parameters_ | |||
|
|||
### useZoomOut | |||
|
|||
A hook used to set the zoomed out view, invoking the hook sets the mode. | |||
A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode. |
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.
To note that the "zoom out mode" is already replaced by edit mode.
d4dbf14
to
7930be8
Compare
e2e test failure was showing Zoom Out mode being active on the parsing patterns tests. Assume this is a bug with this PR. Trying a rebase. If this doesn't resolve then this PR won't make Beta 3. |
The test opens the patterns inserter tab, so I think it's correct that zoomed out is enabled. I'm not sure why the pattern parses incorrectly 🤔 |
Figured out the issue with the test and pushed a fix. The test relies on an existing Now that this PR enables Zoomed Out mode when the patterns tab is selected, the existing The fix disables zoom out mode before trying to insert the pattern. |
Flaky tests detected in 80a63cb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11327046863
|
* Restores setting zoom out mode to useZoomOut hook * Fix test --------- Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org>
I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: 2a28b0d |
* Restores setting zoom out mode to useZoomOut hook * Fix test --------- Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org>
}, [] ); | ||
|
||
// The effect opens the zoom-out view if we want it open and it's not currently in zoom-out mode. | ||
useEffect( () => { |
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 came across this PR while searching for the cause of #66205. I feel like we need to check that it's not a mobile layout here, otherwise the width won't be set correctly when we open the Patterns tab in mobile view.
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 think we'll need to wait and see if #66141 gets backported. However, @PARTHVATALIYA's idea to add it to the inserter useZoomOut conditional should work well for either case. If that route will fix the issue, I think that would work well.
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.
Confirming that we are not intending to backport #66141
* Restores setting zoom out mode to useZoomOut hook * Fix test --------- Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org>
What?
The useZoomOut hook was only setting zoom level, not entering the zoom out mode, which gets it into odd scenarios.
Why?
The bug on trunk:
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Before
https://github.com/user-attachments/assets/dad48d4b-8b56-4d91-bc9e-515f0c5b579b
After
https://github.com/user-attachments/assets/39f08ead-22dc-4c46-b034-fa9385f3e5f1