-
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
Ability to disable block popover through __experimentalUIParts.hasPopover option. #19922
Ability to disable block popover through __experimentalUIParts.hasPopover option. #19922
Conversation
…hasToolbar option.
What will it be used for? |
@ellatrix With PR #18173, parts of the block UI is hidden but they are still rendered. This causes accessibility issues, e.g. when a user is tabbing between elements on screen, suddenly a hidden element on the block toolbar gets focused even though it is not visible on the screen. It will be better to be able to prevent the entire toolbar from rendering when needed. |
This seems fine to me. The only concern I have is that this is not tested. I've run into problems before with these options to disable things and the capturing toolbars not being used by any core blocks and then breaking it. |
In this issue Automattic/wp-calypso#38635, we are currently hiding the toolbar using CSS but ideally if the toolbar can programmatically disabled, that will be better. |
…UIParts.hasToolbar option." This reverts commit a15d882.
@ellatrix I have added test instructions in the updated PR. @jorgefilipecosta I have updated this PR from disabling the block toolbar Let us know if there are any concerns to address, hopefully we can get this approved! |
packages/block-editor/src/components/block-list/root-container.js
Outdated
Show resolved
Hide resolved
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 is working nicely in my testing! 🎉
I left a few small suggestions that I think would make these changes more aligned with prior art 🙂
Co-Authored-By: Bernie Reiter <[email protected]>
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.
Looking good, and still working well.
Since this only modifies something __experimental
, I think we can go ahead and merge, unless someone is strongly opposed (cc @ellatrix and @jorgefilipecosta).
Not sure what changed since I last saw this PR. What happens if the "top toolbar" option is enabled? I think the toolbar will still show in the main top toolbar no? |
Just some context here for clarity, the current component tree looks like this:
We realized that disabling the
Does your "top toolbar" refer to the |
Description
This PR adds ability to disable block popover through the
__experimentalUIParts.hasPopover
option.Why do we need this?
We are using blocks without the need for the block popover, block toolbar and everything around it. The implementation as seen in #18173 only hides them using CSS. While they are not visible visually, the components are still rendered, this causes accessibility issues. When user tabs through the interface, the buttons from the block toolbar is still being focused, even though it is not visible on the screen.
Example Usage:
Test Instructions
We will use storybook to test if the block popover component isn't rendered when the
hasPopover
attribute is set tofalse
. Here are the steps:storybook/stories/playground/index.js
, modify the element<BlockList />
at line 49 to:npm run storybook:dev
.Screenshot
Without
hasPopover: false
With
hasPopover: false