Merge pull request #66 from github/colinwm-combobox-commit

Send original event details in combobox-commit CustomEvent
This commit is contained in:
colinwm 2022-12-14 11:33:26 -05:00 коммит произвёл GitHub
Родитель 2186abbf0e 9daad1b0c4
Коммит 155261eede
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -173,7 +173,7 @@ function commitWithElement(event: MouseEvent) {
const target = event.target.closest('[role="option"]')
if (!target) return
if (target.getAttribute('aria-disabled') === 'true') return
fireCommitEvent(target)
fireCommitEvent(target, {event})
}
function commit(input: HTMLTextAreaElement | HTMLInputElement, list: HTMLElement): boolean {
@ -184,8 +184,8 @@ function commit(input: HTMLTextAreaElement | HTMLInputElement, list: HTMLElement
return true
}
function fireCommitEvent(target: Element): void {
target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true}))
function fireCommitEvent(target: Element, detail?: Record<string, unknown>): void {
target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail}))
}
function visible(el: HTMLElement): boolean {