Skip to content
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

Tabs: update styling to more closely match previous implementation #57275

Merged
merged 2 commits into from Dec 21, 2023

Conversation

chad1008
Copy link
Contributor

Replaces #57121

What?

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

  1. Launch Storybook
  2. 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)
  3. Confirm that the correct accent color is applied to the text when the tab is hovered
  4. Confirm that the text is properly left-aligned

@chad1008 chad1008 requested a review from a team December 20, 2023 16:07
@chad1008 chad1008 self-assigned this Dec 20, 2023
@chad1008 chad1008 added the [Type] Enhancement A suggestion for improvement. label Dec 20, 2023
@chad1008 chad1008 added the CSS Styling Related to editor and front end styles, CSS-specific issues. label Dec 20, 2023
@ciampo ciampo requested a review from a team December 20, 2023 16:49
@ciampo
Copy link
Contributor

ciampo commented Dec 20, 2023

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) ?

@chad1008 chad1008 marked this pull request as ready for review December 20, 2023 18:08
@chad1008
Copy link
Contributor Author

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 😆

@jasmussen
Copy link
Contributor

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) ?

I'd left-align still. It's intentional for here:

Screenshot 2023-12-21 at 10 18 55

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ciampo ciampo merged commit 73af69b into trunk Dec 21, 2023
56 checks passed
@ciampo ciampo deleted the tabs-improve-styling branch December 21, 2023 11:16
@github-actions github-actions bot added this to the Gutenberg 17.4 milestone Dec 21, 2023
@bph bph added [Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality and removed [Type] Enhancement A suggestion for improvement. labels Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants