Skip to content

Commit

Permalink
Merge pull request #516 from gselderslaghs/dropdown-accessibility
Browse files Browse the repository at this point in the history
fix(Dropdown): accessibility - implemented aria-expanded #229
  • Loading branch information
wuda-io authored Nov 6, 2024
2 parents bd1284d + 15cd897 commit 61bcd91
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class Dropdown extends Component<DropdownOptions> implements Openable {
this.isTouchMoving = false;
this.focusedIndex = -1;
this.filterQuery = [];
this.el.ariaExpanded = 'false'

// Move dropdown-content after dropdown-trigger
this._moveDropdown();
Expand Down Expand Up @@ -610,6 +611,7 @@ export class Dropdown extends Component<DropdownOptions> implements Openable {
// Do this one frame later so that we don't bind an event handler that's immediately
// called when the event bubbles up to the document and closes the dropdown
setTimeout(() => this._setupTemporaryEventHandlers(), 0);
this.el.ariaExpanded = 'true'
}

/**
Expand All @@ -628,6 +630,7 @@ export class Dropdown extends Component<DropdownOptions> implements Openable {
if (this.options.autoFocus) {
this.el.focus();
}
this.el.ariaExpanded = 'false'
}

/**
Expand Down

0 comments on commit 61bcd91

Please sign in to comment.