-
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
[WIP] Sidebar: Allow individual blocks to define default tab #45304
[WIP] Sidebar: Allow individual blocks to define default tab #45304
Conversation
// We have multiple tabs with contents so render complete TabPanel. | ||
return ( | ||
<TabPanel | ||
className="block-editor-block-inspector__tabs" | ||
tabs={ availableTabs } | ||
initialTabName={ blockType.defaultTab } | ||
key={ 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.
Open to better approaches here to force the tab panel to reflect different block types' default tabs.
Size Change: +61 B (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
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 am not in favor of this change because it causes a context issue for accessibility. Never knowing which block is going to do what only adds to a much bigger problem about consistency around Gutenberg itself. This would be my down vote sadly. I can see where this may be an improvement visually but it would not help us on the A11Y front.
Thanks for the PR, I wish I could have shared my feedback earlier before you went through the trouble of making it.
Appreciate the timely feedback @alexstine 👍
It would be great if you could find the time to test the main PR this one was based on. In #45005, if a block doesn't render controls into a specific sidebar tab, that tab would be omitted entirely. Introducing another potential inconsistency. Perhaps you could drop a comment on #45005 with your thoughts on that? |
@aaronrobertshaw Thanks for flagging. Dropped a note. I just do not think either one of these will serve us well right now. Thanks. |
Closing this PR, for now, to avoid introducing A11Y issues due to inconsistent UI. |
Depends on:
What?
This PR will explore allowing individual blocks to set their preferred default tab in the sidebar. For example;
Why?
The most frequently needed or used controls by users will differ by block. Allowing for block-specific default tabs may help streamline access and discovery of tools in the block inspector sidebar.
How?
defaultTab
property from the current block type.Possible Issues
To make the TabPanel update/switch to a newly selected block type's default tab, the TabPanel has it's
key
set to the currentclientId
. It will be worth investigating if this might cause any accessibility issues such as focus loss. We might be safe on that front though as theclientId
change would happen when focus is already being moved due to selecting a different block.AAlternative Approaches
defaultTab
property.Testing Instructions
Screenshots or screencast
Screen.Recording.2022-10-26.at.7.17.29.pm.mp4
Note: The "Create a new post" link under the Query block tabs is a known issue and will be address separately.