Skip to content

fix: #19527 - add ariaLabel input to breadcrumb component for accessi…#19538

Open
vitopio-prete wants to merge 1 commit intoprimefaces:masterfrom
vitopio-prete:fix/breadcrumb-aria-label
Open

fix: #19527 - add ariaLabel input to breadcrumb component for accessi…#19538
vitopio-prete wants to merge 1 commit intoprimefaces:masterfrom
vitopio-prete:fix/breadcrumb-aria-label

Conversation

@vitopio-prete
Copy link
Copy Markdown

Fixes #19527

Description

The p-breadcrumb component's root <nav> element had no accessible label, causing axe-core landmark-unique violations when multiple breadcrumb instances appear on the same page.

Although the documentation states that aria-label can be passed implicitly to the root, this is not currently the case, the attribute is not forwarded to the inner <nav>, so consumers have no way to set it without DOM manipulation.

Changes

  • Added an ariaLabel input (string | undefined) on p-breadcrumb, following the same pattern already used in other navigation components such as p-menu
  • Bound [attr.aria-label]="ariaLabel" on the root <nav> element
  • Updated the component's API documentation
  • Added unit tests covering both the DOM attribute binding and the undefined default behavior

Usage

<!-- Single breadcrumb -->
<p-breadcrumb [model]="items" ariaLabel="Breadcrumb" />

<!-- Multiple breadcrumbs on the same page -->
<p-breadcrumb [model]="items1" ariaLabel="Primary navigation" />
<p-breadcrumb [model]="items2" ariaLabel="Secondary navigation" />

Notes

  • Default value is undefined to preserve current behavior and avoid unexpected changes for existing consumers. Consumers are expected to provide a meaningful label when needed (following the W3C APG breadcrumb pattern).
  • No breaking changes.

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.

breadcrumb: nav element missing aria-label causes landmark-unique axe violation

1 participant