Skip to content

feat: wrap expandable section header actions on narrow widths#4804

Draft
ernst-dev wants to merge 1 commit into
mainfrom
feat/expandable-section-header-actions-wrap
Draft

feat: wrap expandable section header actions on narrow widths#4804
ernst-dev wants to merge 1 commit into
mainfrom
feat/expandable-section-header-actions-wrap

Conversation

@ernst-dev

Copy link
Copy Markdown
Member

Description

Allow ExpandableSection header actions (the headerActions slot) to wrap gracefully on narrow container widths instead of overflowing/clipping.

For the non-container variants that render the headerActions slot (default, inline), the header row (.header-actions-wrapper) already sets flex-wrap: wrap, but the heading (.header-wrapper) could not shrink below its content min-size (min-width: auto). On narrow widths this pushed the actions off-screen / clipped the content rather than degrading gracefully.

This change lets the heading shrink and wrap its text (flex: 1 1 auto + min-inline-size: 0 down the title flex chain, plus overflow-wrap: break-word on the header text). The result:

  • On moderately narrow widths the header text wraps first while the actions stay inline.
  • On very narrow widths the actions wrap underneath the title — instead of overflowing or clipping.

Scope is limited to the .header-actions-wrapper path (default / inline variants). The container variant (which routes through the Header component), navigation, and the compact variant (chart popovers, intentionally non-wrapping) are untouched. No public API / prop was added — this is a pure, backward-compatible layout hardening of an existing responsive behavior.

Related links, issue #, if available: AWSUI-60837

Ticket-vs-description note: The SIM ticket AWSUI-60837 ("Allow expandable section header actions to stay inline, wrap header text instead") frames the ask as keeping actions inline and wrapping the header text, and mentions the container-header responsive breakpoint being "too small when widths are always going to be small". The task description for this change frames it as "actions wrap under the title on narrow widths instead of overflowing". Both intents converge on this SCSS fix: the heading now wraps its text first (actions stay inline), and only when there is genuinely no room do the actions drop below the title. The container-variant breakpoint tuning (owned by the Header component) is intentionally out of scope here and noted for follow-up.

How has this been tested?

  • npm run quick-build — green
  • Unit tests: jest src/expandable-section/__tests__ — 182 passed (4 new tests covering the header-actions wrapper for the default and inline variants, and absence of the wrapper when there are no actions)
  • eslint and stylelint on the changed files — green
  • Added a dev page (pages/expandable-section/header-actions-wrap.page.tsx) rendering the sections at 640 / 360 / 240 / 160 px to visually verify wrapping behavior
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.61%. Comparing base (f97729a) to head (cc1282f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4804   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files         952      952           
  Lines       30816    30816           
  Branches    11318    11318           
=======================================
  Hits        30081    30081           
  Misses        688      688           
  Partials       47       47           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant