Skip to content

feat: add secondaryContent to Header - #5255

Open
gethinwebster wants to merge 1 commit into
mainfrom
dev-v3-gethinw-header-secondary-content
Open

gethinwebster wants to merge 1 commit into
mainfrom
dev-v3-gethinw-header-secondary-content

Conversation

@gethinwebster

@gethinwebster gethinwebster commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Description

Adds a secondaryContent prop to Header, as a follow-up from adding the same to ExpandableSection.

Related links, issue #, if available: n/a

How has this been tested?

  • New unit tests: absent by default, rendered outside the heading element for every variant, and placed between the info link and the actions.
  • Header, ExpandableSection and Container unit suites, plus the documenter, test-utils wrapper/selector snapshot suites and the functional test-utils suite, after a full build. Snapshot changes are only the new prop and finder.
  • Checked the permutations page in the browser. The control is centered on the title line in every variant, within 0.5px.
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 Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.82%. Comparing base (c7e4aef) to head (26335b9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5255   +/-   ##
=======================================
  Coverage   97.82%   97.82%           
=======================================
  Files        1006     1006           
  Lines       32566    32567    +1     
  Branches    12095    12095           
=======================================
+ Hits        31857    31858    +1     
+ Misses        703      667   -36     
- Partials        6       42   +36     

☔ 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Passing secondaryContent={0} renders an unwrapped text node, losing the slot’s layout styles and causing findSecondaryContent() to return null despite visible content.

1 open issue
What changed in this PR

Adds a public secondaryContent slot to Header, reusing the existing layout support used by ExpandableSection.

Changes:

  • Exposes secondary content beside the heading and before actions, outside the heading element.
  • Adds findSecondaryContent() to Header test utilities.
  • Adds unit coverage, visual permutations, and updated API snapshots.
File Description
src/​test-utils/​dom/​header/​index.ts Adds the secondary-content finder.
src/​header/​styles.scss Renames slot selectors to match the public prop.
src/​header/​internal.tsx Replaces the internal slot prop with secondaryContent.
src/​header/​interfaces.ts Defines and documents the public prop.
src/​header/​__tests__/​header.test.tsx Tests default absence, heading separation, and content order.
src/​expandable-section/​expandable-section-header.tsx Passes secondary content through the new prop.
src/​__tests__/​snapshot-tests/​__snapshots__/​test-utils-selectors.test.tsx.snap Records the new slot selector.
src/​__tests__/​snapshot-tests/​__snapshots__/​documenter.test.ts.snap Records the prop and test-utils finder.
pages/​header/​permutations.page.tsx Adds secondary-content visual permutations.

Review effort: Balanced

Comment thread src/header/internal.tsx Resolved

This branch was successfully deployed

3 active deployments
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.

2 participants