Skip to content

Commit 3a5d314

Browse files
authored
Merge a8397ef into 9637998
2 parents 9637998 + a8397ef commit 3a5d314

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.changeset/grumpy-lemons-like.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
"@patternfly/elements": patch
3+
---
4+
`<pf-jump-links>`: improve screen reader accessibility by labeling the navigation landmark element

elements/pf-jump-links/pf-jump-links.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ export class PfJumpLinks extends LitElement {
7272
/** Offset to add to the scroll position, potentially for a masthead which content scrolls under. */
7373
@property({ type: Number }) offset = 0;
7474

75-
/** Label to add to nav element. */
76-
@property() label?: string;
75+
/** Label to add to nav element. Required for accessibility. */
76+
@property({ reflect: true }) label = 'Jump to section';
7777

7878
#kids = this.querySelectorAll?.<LitElement>(':is(pf-jump-links-item, pf-jump-links-list)');
7979

@@ -121,11 +121,11 @@ export class PfJumpLinks extends LitElement {
121121

122122
render(): TemplateResult<1> {
123123
return html`
124-
<nav id="container">${this.expandable ? html`
124+
<nav id="container" aria-labelledby="label">${this.expandable ? html`
125125
<details ?open="${this.expanded}" @toggle="${this.#onToggle}">
126126
<summary>
127127
<pf-icon icon="chevron-right"></pf-icon>
128-
<span id="label">${this.label}</span>
128+
<span part="label" id="label">${this.label}</span>
129129
</summary>
130130
<div role="listbox" aria-labelledby="label">
131131
<slot></slot>

0 commit comments

Comments
 (0)