Open jeryj opened 3 days ago
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 props-bot
label.
If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
Co-authored-by: jeryj <jeryj@git.wordpress.org>
Co-authored-by: draganescu <andraganescu@git.wordpress.org>
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.
@draganescu @richtabor I'd be interested in your thoughts on this approach vs https://github.com/WordPress/gutenberg/pull/66381.
Please try them both out and see which one feels like a nicer UX.
Size Change: +79 B (0%)
Total Size: 1.81 MB
Filename | Size | Change |
---|---|---|
build/block-editor/index.min.js |
254 kB | +79 B (+0.03%) |
Flaky tests detected in 95712221841d646fe8aa414361fbd32f05234528. Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11581302494 📝 Reported issues:
/test/e2e/specs/editor/various/taxonomies.spec.js
I think this PR works better in terms of expected outcome. The idea is this:
This PR achieves this for the inserter:
However, this does not work for the global styles -> browse styles: here if the user starts in default zoom view, and opens browse styles, we programatically enter zoom out view, but exiting browse styles does not revert to default zoom view.
It looks like the global styles UI is mounted twice for some reason, so when it mounts, it runs useZoomOut
twice which toggles it to zoom out, then remounts useZoomOut
which makes it think it should not be in controlled mode since you're already zoomed out.
I don't think it's caused by react dev mode, but maybe. I'm not sure if the bug is the component being mounted twice or if the useZoomOut implementation for the global styles sidebar should change.
What?
Only control zoom level in useZoomOut if starting from non-zoomed state
Why?
This modifies the idea of the useZoomOut state to allow for a controlled mode. If the user begins in zoom out or manually toggles the zoom level, then we assume they are a user who understands the zoom levels and doesn't need this toggled for them. If they begin from a non-zoomed state, we can zoom in when they reach the patterns tab and remove the zoom level when they exit the inserter. If they use the zoom button when the inserter is open, this also removes the control mode, as they understand how to enter and exit zoom out.
The idea here is:
How?
Add controlZoomLevel ref to track if we should be controlling the zoom level for the user or not.
Testing Instructions
Starting from Zoom Out
Starting from Zoom In (zoom level === 100)
Starting from Zoom In (zoom level === 100) and manually toggle zoom mode via header (exit control mode)
Testing Instructions for Keyboard
Screenshots or screencast