Skip to content

Commit c4924b1

Browse files
committed
Allow default behaivor onclick to go through
If there shouldn't be a native behaivor then the markup should reflect that. Clicking on commit triggered by keydown so the default behaivor of an element would be triggered (link/submit).
1 parent f5911ef commit c4924b1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

combobox-nav.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ function commitWithElement(event: MouseEvent) {
6363
if (!(event.target instanceof Element)) return
6464
const target = event.target.closest('[role="option"]')
6565
if (!target) return
66-
event.preventDefault()
6766
if (target.getAttribute('aria-disabled') === 'true') return
6867
fireCommitEvent(target)
6968
}
@@ -72,7 +71,7 @@ function commit(input: HTMLTextAreaElement | HTMLInputElement, list: HTMLElement
7271
const target = list.querySelector('[aria-selected="true"]')
7372
if (!target) return false
7473
if (target.getAttribute('aria-disabled') === 'true') return true
75-
fireCommitEvent(target)
74+
target.click()
7675
return true
7776
}
7877

0 commit comments

Comments
 (0)