You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tabs: update styling to more closely match previous implementation - #57275
Updates the styling on Tabs to match the legacy TabPanel component
Why?
To avoid being overly opinionated, Tabs is set up to render a vanilla button element, allowing consumers to opt for a Button component if they wish, via the render prop.
This caused a few styles to be lost, such as the hover color and the alignment of the text on tabs when the tab is wider than its contents.
How?
Add the hover color and necessary layout attributes directly to the default tab element.
Testing Instructions
Launch Storybook
Add a flex-grow:1 style to each of the Tabs.Tab components in the Default story (making them wide enough for text alignment to be noticeable)
Confirm that the correct accent color is applied to the text when the tab is hovered
Pinging @WordPress/gutenberg-design folks specifically about the text aligning — should we align text in the tab buttons to the left by default (like we do on the legacy TabPanel), or should we keep the text center aligned (like currently on Tabs) ?
should we align text in the tab buttons to the left by default (like we do on the legacy TabPanel), or should we keep the text center aligned (like currently on Tabs) ?
Throwing out one additional wrinkle I've just come across:
If we decide we want center aligned text on tabs, we should consider how that would look on a vertically oriented tablist, like the one we currently render in the Editor Preferences Modal. I kind of like the centered text on horizontal tabs, but I don't think it works as well vertically. I'm glad we have brilliant design experts to make these calls 😆
folks specifically about the text aligning — should we align text in the tab buttons to the left by default (like we do on the legacy TabPanel), or should we keep the text center aligned (like currently on Tabs) ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #57121
What?
Updates the styling on
Tabsto match the legacyTabPanelcomponentWhy?
To avoid being overly opinionated,
Tabsis set up to render a vanillabuttonelement, allowing consumers to opt for aButtoncomponent if they wish, via therenderprop.This caused a few styles to be lost, such as the hover color and the alignment of the text on tabs when the tab is wider than its contents.
How?
Add the hover color and necessary layout attributes directly to the default
tabelement.Testing Instructions
flex-grow:1style to each of theTabs.Tabcomponents in the Default story (making them wide enough for text alignment to be noticeable)