Skip to content

Commit f0d1d62

Browse files
authored
Merge pull request #9 from github/clear-all-selected
Clear all selected items
2 parents b2933b7 + 3c65963 commit f0d1d62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

combobox-nav.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ export function navigate(
111111

112112
export function clearSelection(input: HTMLTextAreaElement | HTMLInputElement, list: HTMLElement): void {
113113
input.removeAttribute('aria-activedescendant')
114-
const target = list.querySelector('[aria-selected="true"]')
115-
if (!target) return
116-
target.setAttribute('aria-selected', 'false')
114+
for (const el of list.querySelectorAll('[aria-selected="true"]')) {
115+
el.setAttribute('aria-selected', 'false')
116+
}
117117
}
118118

119119
function trackComposition(event: Event): void {

0 commit comments

Comments
 (0)