-
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
Only exit zoom out on double clicking the section itself #65782
Conversation
Size Change: +17 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
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. |
This could probably land in 6.7 and not have any side effects. |
@@ -113,7 +113,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) { | |||
useBlockRefProvider( clientId ), | |||
useFocusHandler( clientId ), | |||
useEventHandlers( { clientId, isSelected } ), | |||
useZoomOutModeExit( { editorMode } ), | |||
useZoomOutModeExit( { clientId, editorMode } ), |
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.
Looks like editorMode is dropped in #65326, so this probably needs a rebase.
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.
👍
const sectionsClientIds = getBlockOrder( getSectionRootClientId() ); | ||
|
||
const isSectionBlock = sectionsClientIds.includes( clientId ); |
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 guess in the future this could use the isSectionBlock
selector, but it seems incompatible with zoom out mode right now because it checks for navigation 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.
That selector should be mode agnostic surely? I'll take a look at 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.
I guess the selector is saying that there are no section blocks when in a mode that doesn't support sections.
When looked at that way zoom out could be included in part of the selector's logic.
The selector does also include a few other clauses, so would need to also check they don't introduce edge cases for 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.
Works well and code looks good.
E2E tests would probably be good for this kind of thing, especially with the feature landing in 6.7. I'd be happy to help with writing some.
Yes this feature really needs some e2e tests 🙏 Shall we open and Issue and scope some out and then write them. I'm thinking a few high level tests to validate key functionality. |
Sounds good. I can make one and then we can split up the tasks of writing the tests once some basic tests are in place. edit: here's an issue - #65797 |
0ae7c03
to
8855e20
Compare
Sorry for the pings. I managed to break everything with a bad rebase! |
8855e20
to
8fc57ed
Compare
8fc57ed
to
3f1ed6c
Compare
Ah...I rebased from |
3f1ed6c
to
6458b58
Compare
# Conflicts: # packages/block-editor/src/components/block-list/use-block-props/index.js # packages/block-editor/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js
6458b58
to
250477f
Compare
Ok this is no longer working. Going to close and try again. |
What?
Fixes Zoom Out so that only double clicking on the section block itself will exit Zoom Out mode.
Based on #65702
Closes #65750.
Why?
See #65750
Previously clicking on any block would exit Zoom Out unexpectedly. Now only section blocks handle the event.
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Screen.Capture.on.2024-10-01.at.11-06-33.mp4