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: hyphenate tab labels #63337

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Tabs: hyphenate tab labels #63337

merged 2 commits into from
Jul 10, 2024

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Jul 10, 2024

What?

Related to #62020

Add automatic hyphenation for tab labels in the Tabs component

Why?

To prevent long tab labels from pushing the width of the tab list and causing unexpected scrolling behavior.

How?

By using the hyphens CSS property as suggested by @jameskoster

Testing Instructions

  • Open Storybook
  • Change the tab labels to become more verbose, including very long single words
  • Observe how the labels are broken (hyphenated) into multiple lines, preventing the tablist from overflowing and causing horizontal scroll in the document

Screenshots or screencast

Before (trunk) After (this PR)
Screenshot 2024-07-10 at 08 53 49 Screenshot 2024-07-10 at 08 53 38

@ciampo ciampo requested a review from ajitbohra as a code owner July 10, 2024 06:54
@ciampo ciampo requested review from jameskoster and a team July 10, 2024 06:54
@ciampo ciampo self-assigned this Jul 10, 2024
Copy link

github-actions bot commented Jul 10, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ciampo ciampo added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Jul 10, 2024
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Given multiline tabs should be a rare edge-case, I think this is a good compromise.

@ciampo ciampo merged commit bdfd1d7 into trunk Jul 10, 2024
63 checks passed
@ciampo ciampo deleted the feat/tabs-tab-word-break branch July 10, 2024 10:58
@github-actions github-actions bot added this to the Gutenberg 18.9 milestone Jul 10, 2024
carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Jul 18, 2024
* Tabs: hyphenate tab labels

* CHANGELOG

---

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants