Skip to content

Commit

Permalink
fix(input-field): ensure aria-controls get ids of both helper text …
Browse files Browse the repository at this point in the history
…& portal
  • Loading branch information
Kiarokh authored and jgroth committed Apr 4, 2024
1 parent c29a64f commit 26d26ac
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/input-field/input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,25 @@ export class InputField {
properties.readonly = this.readonly;
properties.disabled = this.disabled || this.readonly;

let ariaControls = '';

if (this.hasHelperText()) {
properties['aria-controls'] = this.helperTextId;
ariaControls += this.helperTextId;
properties['aria-describedby'] = this.helperTextId;
}

if (this.renderAutocompleteList()) {
if (ariaControls) {
ariaControls += ' ';
}

ariaControls += this.portalId;
}

if (ariaControls) {
properties['aria-controls'] = ariaControls;
}

return [
<label class={this.getContainerClassList()}>
<span class="mdc-notched-outline" tabindex="-1">
Expand Down

0 comments on commit 26d26ac

Please sign in to comment.