Skip to content

Commit a8c4d22

Browse files
committed
colinwm-combobox-commit
1 parent 2186abb commit a8c4d22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function commitWithElement(event: MouseEvent) {
173173
const target = event.target.closest('[role="option"]')
174174
if (!target) return
175175
if (target.getAttribute('aria-disabled') === 'true') return
176-
fireCommitEvent(target)
176+
fireCommitEvent(target, event)
177177
}
178178

179179
function commit(input: HTMLTextAreaElement | HTMLInputElement, list: HTMLElement): boolean {
@@ -184,8 +184,8 @@ function commit(input: HTMLTextAreaElement | HTMLInputElement, list: HTMLElement
184184
return true
185185
}
186186

187-
function fireCommitEvent(target: Element): void {
188-
target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true}))
187+
function fireCommitEvent(target: Element, originalEvent?: MouseEvent): void {
188+
target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, originalEvent}))
189189
}
190190

191191
function visible(el: HTMLElement): boolean {

0 commit comments

Comments
 (0)