Skip to content

Commit fd699d5

Browse files
committed
fix: adds an aria-label to the caret button with a matching property
1 parent 195cd6f commit fd699d5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/uui-menu-item/lib/uui-menu-item.element.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
111111
@property({ type: String, attribute: 'select-mode', reflect: true })
112112
public selectMode?: 'highlight' | 'persisting';
113113

114+
/**
115+
* Sets the aria-label for the caret button.
116+
* @remark Only used when the menu item has children.
117+
* @attr
118+
* @default 'Reveal the underlying items'
119+
*/
120+
@property({ type: String, attribute: 'caret-label' })
121+
public caretLabel = 'Reveal the underlying items';
122+
114123
@state()
115124
private iconSlotHasContent = false;
116125

@@ -206,8 +215,13 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
206215
return html`
207216
<div id="menu-item" aria-label="menuitem" role="menuitem">
208217
${this.hasChildren
209-
? html`<button id="caret-button" @click=${this._onCaretClicked}>
210-
<uui-symbol-expand ?open=${this.showChildren}></uui-symbol-expand>
218+
? html`<button
219+
id="caret-button"
220+
aria-label=${this.caretLabel}
221+
@click=${this._onCaretClicked}>
222+
<uui-symbol-expand
223+
aria-hidden="true"
224+
?open=${this.showChildren}></uui-symbol-expand>
211225
</button>`
212226
: ''}
213227
${this.href ? this._renderLabelAsAnchor() : this._renderLabelAsButton()}

0 commit comments

Comments
 (0)