Skip to content

Commit 9daad1b

Browse files
committed
colinwm-combobox-commit
1 parent f69db8c commit 9daad1b

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, event)
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, originalEvent?: MouseEvent): void {
188-
target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail: {originalEvent}}))
187+
function fireCommitEvent(target: Element, detail?: Record<string, unknown>): void {
188+
target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail}))
189189
}
190190

191191
function visible(el: HTMLElement): boolean {

0 commit comments

Comments
 (0)