Skip to content

Stop nav overflow growing in column flex parents - #43270

Open
1AbdullahButt wants to merge 1 commit into
twbs:mainfrom
1AbdullahButt:nav-overflow-column-parent
Open

1AbdullahButt wants to merge 1 commit into
twbs:mainfrom
1AbdullahButt:nav-overflow-column-parent

Conversation

@1AbdullahButt

@1AbdullahButt 1AbdullahButt commented Nov 2, 2026 •

Copy link
Copy Markdown

Description

  • Remove flex-grow from .nav-overflow when its parent is a .card, .dialog, .drawer, or .flex-column.
  • Skip this rule when the parent also has a row class, such as .md:flex-row or .flex-row. In a row, a wrapper that doesn't grow is 0px wide, and every item moves to "More".
  • Add a docs section for other column parents: .flex-grow-0, or .flex-grow-0 .md:flex-grow-1 for a parent that changes direction.

Motivation & Context

  • flex: 1 1 0 gives the wrapper its width in a row. In a column, it takes a share of the free height.
  • CSS can't read the parent's direction, so no single rule on .nav-overflow works for both. This rule names the known column parents.
  • The issue suggests growth only in .navbar. I didn't use it, because each plain .d-flex row would collapse to 0px until the author adds .flex-fill. This change has no effect on rows.
  • .card and .dialog aren't in the issue. I added them because they show the same bug with a fixed height.
  • These column parents still have the bug and need the documented class: custom CSS columns, .md:flex-column, .flex-column-reverse, and .lg:drawer below its breakpoint. A .flex-column with a row class also still has the bug while it is a column.
  • [class*="-row"] also matches unrelated classes, such as .my-row. In that case the bug stays, but the nav doesn't collapse.

Height of the wrapper with a 38px nav, measured in Chromium at 1920×1080 with the compiled CSS and the JS bundle:

Parent Before After
.drawer 466px 38px
.flex-column.min-vh-100 516px 38px
.card, 600px high 247px 38px
.dialog, 600px high 243px 38px
  • The next sibling now starts directly below the nav in all four cases. .flex-grow-1 on the wrapper still overrides the rule.
  • These rows have the same wrapper size before and after, with no moved items: .d-flex, .d-flex.flex-wrap, .navbar, .flex-column.md:flex-row at 1920px, and .card.flex-row. A block parent also doesn't change.
  • Items still move to "More" in a narrow .drawer.
  • npm run lint exits 0 with 6 warnings and no errors. npm run css-test, npm run css, and npm run docs-build pass.
  • I didn't test in Firefox or Safari. I didn't run the JS unit tests, because this change has no JS. The issue reports that .flex-grow-0 already works in Firefox, and this rule sets the same property.
  • I added no automated test, because I found no layout tests for the SCSS in scss/tests.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

Fixes #43162

🤖 Generated with Claude Code

The wrapper needs `flex-grow` to get a width in a row, but in a column
the same grow takes a share of the free height. This pushes the next
sibling away from the nav. CSS can't read the parent's direction, so
remove the grow only under the known column parents, and document
`.flex-grow-0` for the others. Rows don't change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1AbdullahButt
1AbdullahButt requested a review from a team as a code owner November 2, 2026 17:28
@julien-deramond julien-deramond added v6 v6, the main branch bug Something does not work as documented css Sass sources or compiled CSS docs Documentation site and its content labels Nov 2, 2026

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

bug Something does not work as documented css Sass sources or compiled CSS docs Documentation site and its content v6 v6, the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.nav-overflow grows vertically when its parent is a column flex container

2 participants