Skip to content

Tabs: Add horizontal scrolling for non-wrapping tab lists - #80247

Open
Mustafabharmal wants to merge 1 commit into
WordPress:trunkfrom
Mustafabharmal:fix/80239-tab-list-horizontal-scroll
Open

Mustafabharmal wants to merge 1 commit into
WordPress:trunkfrom
Mustafabharmal:fix/80239-tab-list-horizontal-scroll

Conversation

@Mustafabharmal

Copy link
Copy Markdown
Contributor

What?

Closes #80239.

Adds support for disabling wrapping in the Tab List block and enables horizontal scrolling when wrapping is turned off.

Why?

The Tab List block now wraps onto multiple lines by default, which provides a better experience when many tabs are present.

However, the block did not expose the existing allowWrap layout support, so authors could not choose to keep the tab list on a single row.

Simply enabling that layout support is not sufficient. When wrapping is disabled, the tab list can overflow its container and individual tab buttons shrink, causing tab labels to wrap onto multiple lines.

This change completes the non-wrapping experience by allowing the tab list to scroll horizontally while preserving each tab's natural width.

How?

This PR builds on Gutenberg's existing flex layout support.

  • Enables the existing allowWrap layout support for the Tab List block.
  • Uses the existing .is-nowrap class added by the layout system when wrapping is disabled.
  • Adds horizontal scrolling for the non-wrapping layout.
  • Prevents tab buttons from shrinking so their labels remain on a single line.
  • Updates the generated block documentation to reflect the newly enabled layout support.

Testing Instructions

  1. Create a new post or page.
  2. Insert a Tabs block.
  3. Add enough tabs so they exceed the available width.
  4. Select the Tab List block.
  5. Open the Layout panel.
  6. Verify the Allow wrapping option is now available.
  7. Disable Allow wrapping.
  8. Verify the tab list remains on a single row.
  9. Verify the tab list becomes horizontally scrollable.
  10. Verify tab labels remain on a single line and do not wrap.
  11. Enable Allow wrapping again.
  12. Verify the tabs wrap onto multiple rows.

Screenshots or screencast

Before

  • The Tab List block does not expose an Allow wrapping option.
  • Tabs remain wrapped by default with no way to switch to a horizontally scrollable single-row layout.
Tab.blocks.Before.fix.mov

After

  • The Tab List block exposes the Allow wrapping layout option.
  • Disabling wrapping keeps the tabs on a single row with horizontal scrolling, while tab labels remain on a single line.
Tab.blocks.After.fix.mov

@github-actions

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: Mustafabharmal <mustafabharmal@git.wordpress.org>
Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>

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

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Jul 14, 2026
@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Tabs Affects the Tabs Block labels Jul 15, 2026

@Mayank-Tripathi32 Mayank-Tripathi32 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.

Thanks for opening PR,

Two things to confirm:

  • long tab labels don't line-break when scrolling (the explicit requirement in [#80239]. flex-shrink: 0 should cover it, but a screenshot with long labels would settle it),

  • and allowWrap: false was set deliberately just a month ago in #77646 as part of narrowing Tabs to essential options. #80239 seems like good place to discuss, Lets see if @t-hamano can confirm that resurfacing the generic wrap toggle is the intended way to deliver a "scroll option".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Tabs Affects the Tabs Block [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tabs block: Add horizontal scroll option

3 participants