-
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
Make zoom out vertical toolbar consistent #65627
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: +179 B (+0.01%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
bc8dea0
to
7c4075d
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
Flaky tests detected in 9cc9dd2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11099593244
|
5d5b959
to
f85357c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
Co-authored-by: Dave Smith <getdavemail@gmail.com>
Co-authored-by: Dave Smith <getdavemail@gmail.com>
…cal toolbar, also fix typo
3b5b062
to
0afb084
Compare
… of dom classname
I discovered that there's a prop |
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.
For me this now tests really well and I can no longer find edge cases.
Great work here @draganescu for all the upfront effort and also @talldan for jumping in with improvements to selecting "the canvas".
I'd be happy to merge.
There was a conflict while trying to cherry-pick the commit to the wp/6.7 branch. Please resolve the conflict manually and create a PR to the wp/6.7 branch. PRs to wp/6.7 are similar to PRs to trunk, but you should base your PR on the wp/6.7 branch instead of trunk.
|
@draganescu Would you be able to try getting this to cherry pick cleanly into the |
* enable vertical toolbar for non full width elements, anchor based on parent * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * make zoom out check a dependency of the memoization, improve code readability * comment typos * subscribe to state instead of calculating zoom out view state when calculating the anchor * get the section wrapper for anchoring instead of the parent * use a selector instead of computing on the fly the parent section * check if the block element exists yet before computing the anchor * check if the block element exists yet before computing the anchor * differentiate between section toolbar and block toolbar for correct positioning when both are visible * address some nits * make the select in anchor setting rerun when block selection changes * fix bug with anchor rect when zoom out not engaged * fix typo * Use root container element in post editor as popover anchor * improve comment * improve comment to max improvement possible Co-authored-by: Dave Smith <getdavemail@gmail.com> * mega nit commit Co-authored-by: Dave Smith <getdavemail@gmail.com> * Fix bug with Posts with no full width blocks * give up on section root, always seek canvas element to position vertical toolbar, also fix typo * introduce the concept of canvas via a 1st variable * Use `__unstableContentRef` for zoomed out toolbar positioning instead of dom classname --------- Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
The cherry pick PR #66119 solved conflicts but now has a missing function. |
selectedElement, | ||
popoverDimensionsRecomputeCounter, | ||
isSectionSelected, | ||
__unstableContentRef, |
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 don't really understand the change here. Can you explain why the block popover component needs to be aware of 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.
The reason I'm confused is because for me the "BlockPopover" is just a component that gives you the "position" of the block. So I don't see how zoom-out is related. It's not about giving the position of the toolbar, it's about giving the position of the block. It just happens that toolbar is adjacent to the block (in most cases). I think if we need to adapt the position differently in zoom-out, we should either have clear props in this component to change the behavior (for instance a prop that clearly indicates how we want to change the behavior) or do this computation elsewhere.
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.
"BlockPopover" is just a component that gives you the "position" of the block.
I don't know what to say about that, since this does render a whole popover, it's not some utility called to get the position. I do get the concern though.
I think if we need to adapt the position differently in zoom-out, we should either have clear props in this component to change the behavior
That is a good alternative sure. But at some point someone will have to "know" about zoom out.
Let's wait on the faith of this toolbar and if it sticks around return to reflect in code the idea that toolbars "just happen" to be adjacent to blocks. This was intended as a bug fix and it does not introduce a big glaring problem IMO just some minor tech debt reflecting the issue with multiple toolbar types.
Do you agree?
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.
yes :)
* enable vertical toolbar for non full width elements, anchor based on parent * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * make zoom out check a dependency of the memoization, improve code readability * comment typos * subscribe to state instead of calculating zoom out view state when calculating the anchor * get the section wrapper for anchoring instead of the parent * use a selector instead of computing on the fly the parent section * check if the block element exists yet before computing the anchor * check if the block element exists yet before computing the anchor * differentiate between section toolbar and block toolbar for correct positioning when both are visible * address some nits * make the select in anchor setting rerun when block selection changes * fix bug with anchor rect when zoom out not engaged * fix typo * Use root container element in post editor as popover anchor * improve comment * improve comment to max improvement possible Co-authored-by: Dave Smith <getdavemail@gmail.com> * mega nit commit Co-authored-by: Dave Smith <getdavemail@gmail.com> * Fix bug with Posts with no full width blocks * give up on section root, always seek canvas element to position vertical toolbar, also fix typo * introduce the concept of canvas via a 1st variable * Use `__unstableContentRef` for zoomed out toolbar positioning instead of dom classname --------- Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
* Make zoom out vertical toolbar consistent (#65627) * enable vertical toolbar for non full width elements, anchor based on parent * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * make zoom out check a dependency of the memoization, improve code readability * comment typos * subscribe to state instead of calculating zoom out view state when calculating the anchor * get the section wrapper for anchoring instead of the parent * use a selector instead of computing on the fly the parent section * check if the block element exists yet before computing the anchor * check if the block element exists yet before computing the anchor * differentiate between section toolbar and block toolbar for correct positioning when both are visible * address some nits * make the select in anchor setting rerun when block selection changes * fix bug with anchor rect when zoom out not engaged * fix typo * Use root container element in post editor as popover anchor * improve comment * improve comment to max improvement possible Co-authored-by: Dave Smith <getdavemail@gmail.com> * mega nit commit Co-authored-by: Dave Smith <getdavemail@gmail.com> * Fix bug with Posts with no full width blocks * give up on section root, always seek canvas element to position vertical toolbar, also fix typo * introduce the concept of canvas via a 1st variable * Use `__unstableContentRef` for zoomed out toolbar positioning instead of dom classname --------- Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> * bring over two private selectors from trunk the fix depends on --------- Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Updating labels as backported in #66119 |
* enable vertical toolbar for non full width elements, anchor based on parent * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * Update packages/block-editor/src/components/block-popover/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * make zoom out check a dependency of the memoization, improve code readability * comment typos * subscribe to state instead of calculating zoom out view state when calculating the anchor * get the section wrapper for anchoring instead of the parent * use a selector instead of computing on the fly the parent section * check if the block element exists yet before computing the anchor * check if the block element exists yet before computing the anchor * differentiate between section toolbar and block toolbar for correct positioning when both are visible * address some nits * make the select in anchor setting rerun when block selection changes * fix bug with anchor rect when zoom out not engaged * fix typo * Use root container element in post editor as popover anchor * improve comment * improve comment to max improvement possible Co-authored-by: Dave Smith <getdavemail@gmail.com> * mega nit commit Co-authored-by: Dave Smith <getdavemail@gmail.com> * Fix bug with Posts with no full width blocks * give up on section root, always seek canvas element to position vertical toolbar, also fix typo * introduce the concept of canvas via a 1st variable * Use `__unstableContentRef` for zoomed out toolbar positioning instead of dom classname --------- Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
What?
Closes #65785
Fixes #65570
Make sure all the elements identified as sections - full width or not.- display the same vertical toolbar specific to sections.
Why?
Consistent UI.
How?
ZoomOutToolbar
for all sections and remove the full width condition.Testing Instructions
Testing Instructions for Keyboard
N/A
Screenshots or screencast
consistent-toolbar.mp4
Related #63519 - the difference in how in the post editor we only have an html container but no container block is problematic here too.
Co-authored-by: draganescu andraganescu@git.wordpress.org
Co-authored-by: getdave get_dave@git.wordpress.org
Co-authored-by: talldan talldanwp@git.wordpress.org
Co-authored-by: ciampo mciampini@git.wordpress.org
Co-authored-by: jsnajdr jsnajdr@git.wordpress.org
Co-authored-by: MaggieCabrera onemaggie@git.wordpress.org
Co-authored-by: richtabor richtabor@git.wordpress.org
Co-authored-by: stokesman presstoke@git.wordpress.org
Co-authored-by: andrewserong andrewserong@git.wordpress.org