Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kochis committed Jun 27, 2024
1 parent 829d82b commit ee499ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ui/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class AutocompleteUI {
// result list element
this.resultsList = document.createElement('ul');
this.resultsList.classList.add(CLASSNAMES.RESULTS_LIST);
this.resultsList.classList.add('id', CLASSNAMES.RESULTS_LIST);
this.resultsList.setAttribute('id', CLASSNAMES.RESULTS_LIST);
this.resultsList.setAttribute('role', 'listbox');
this.resultsList.setAttribute('aria-live', 'polite');
this.resultsList.setAttribute('aria-label', 'Search results');
Expand Down Expand Up @@ -284,7 +284,7 @@ class AutocompleteUI {
const li = document.createElement('li');
li.classList.add(CLASSNAMES.RESULTS_ITEM);
li.setAttribute('role', 'option');
li.setAttribute('id', `item-${index}`);
li.setAttribute('id', `${CLASSNAMES.RESULTS_ITEM}}-${index}`);

// construct result with bolded label
let listContent;
Expand Down Expand Up @@ -392,7 +392,7 @@ class AutocompleteUI {
resultItems[index].classList.add(CLASSNAMES.SELECTED_ITEM);

// set aria active descendant
this.inputField.setAttribute('aria-activedescendant', `item-${index}`);
this.inputField.setAttribute('aria-activedescendant', `${CLASSNAMES.RESULTS_ITEM}-${index}`);

this.highlightedIndex = index;
}
Expand Down

0 comments on commit ee499ba

Please sign in to comment.