Skip to content

Banner: Allow Banner.Title to be set as <p> - #8275

Open
TylerJDev wants to merge 3 commits into
mainfrom
tylerjdev/adjust-as-banner-title
Open

Banner: Allow Banner.Title to be set as <p>#8275
TylerJDev wants to merge 3 commits into
mainfrom
tylerjdev/adjust-as-banner-title

Conversation

@TylerJDev

@TylerJDev TylerJDev commented Aug 6, 2026

Copy link
Copy Markdown
Member

Part of https://github.com/github/accessibility-audits/issues/16930

This PR allows Banner.Title to be rendered as a paragraph (<p>) in addition to the existing heading levels (h2h6).

In some contexts, a Banner is used where a heading is not appropriate. Rendering the title as a heading in those cases introduces an unnecessary heading into the document structure, which can be disorienting for screen reader users.

Allowing Banner.Title to be set as a <p> lets consumers avoid an unnecessary heading level while keeping the visual styling of the title.

The default remains h2, so this is a non-breaking, additive change.

Changelog

New

  • Banner.Title now supports as="p" to render the title as a paragraph instead of a heading.

Changed

  • Updated the as prop type for Banner.Title from 'h2' | 'h3' | 'h4' | 'h5' | 'h6' to also include 'p', and documented the default value of 'h2'.

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

  • Verify Banner.Title still renders as an h2 heading by default.
  • Verify Banner.Title as="p" renders a paragraph element (no heading role) — see the added test should support rendering as a paragraph element.
  • Confirm existing heading-level rendering (h2h6) is unchanged.

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a54814

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@TylerJDev
TylerJDev marked this pull request as ready for review August 6, 2026 15:15
@TylerJDev
TylerJDev requested a review from a team as a code owner August 6, 2026 15:15
@TylerJDev
TylerJDev requested review from siddharthkp and a lite review from Copilot and removed request for Copilot August 6, 2026 15:15
@primer

primer Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Lint and formatting issues have been automatically fixed and committed to this PR.

@TylerJDev TylerJDev added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants