Skip to content

[Bug] TopNav: the heading's wrapper never shrinks, so a long heading runs out of its column #9530

Closed

Description

@duytbp

Description

TopNav wraps heading in a div that never shrinks (styles.heading, flexShrink: 0, TopNav.tsx#L66-L70, rendered at #L294). The section that holds it does shrink (leftSection: flex: 1 1 0%, minWidth: 0), so when the heading is wider than its share of the bar it overflows the section instead of narrowing.

With centerContent the bar is a 1fr auto 1fr grid, so the start column is fixed. A long heading, such as a workspace name, then runs out of its column and under the centre content. A TopNavHeading whose text truncates never gets its ellipsis, because nothing narrows it. Without centerContent the same heading runs under endContent.

Expected: the heading wrapper shrinks with its section (flexShrink: 1, minWidth: 0), so a heading that can truncate does so inside its column, and the centre content keeps its place.

Reproduction

import {TopNav, TopNavHeading, TopNavItem} from '@astryxdesign/core';

export function Repro() {
  return (
    <div style={{width: 1280}}>
      <TopNav
        label="Main"
        heading={<TopNavHeading heading="Công ty Cổ phần Giải pháp Nhân sự Hải Đăng Việt Nam" />}
        centerContent={<input aria-label="Search" style={{width: 560}} />}
        endContent={<button type="button">Account</button>}
      >
        <TopNavItem label="Jobs" href="/jobs" />
      </TopNav>
    </div>
  );
}
  1. Render it 1280px wide. The grid gives the start column 352px.
  2. The heading's wrapper is 448px wide: it runs past its column and under the search field, and the name shows no ellipsis.
  3. In jsdom, the wrapper of the heading (the first child of the bar's first section) carries the class whose rule is flex-shrink: 0.

Astryx Version

@astryxdesign/[email protected], still present on main (346a3c3)

Environment

Any browser. The 1280px widths are from an app's Chromium capture at 1280×800; the wrapper's flex-shrink: 0 was read in jsdom (Vitest, Testing Library).

Activity

  1. added
    bug
    component
    on Nov 2, 2026
  2. added a commit that references this issue on Nov 8, 2026
    aba9283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugcomponent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions