Skip to content

Tabs: hyphenate tab labels - #63337

Merged
ciampo merged 2 commits into
trunkfrom
feat/tabs-tab-word-break
Jul 10, 2024
Merged

ciampo merged 2 commits into
trunkfrom
feat/tabs-tab-word-break

Conversation

@ciampo

@ciampo ciampo commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

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 a team and jameskoster July 10, 2024 06:54
@ciampo ciampo self-assigned this Jul 10, 2024
@github-actions

github-actions Bot commented Jul 10, 2024 •

Copy link
Copy Markdown

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

@tyxla tyxla left a comment

Copy link
Copy Markdown
Member

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
@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