From a8c4d22b1f936e573ca50bf83b7b3c6d571fd5a0 Mon Sep 17 00:00:00 2001 From: Colin Merkel Date: Mon, 12 Dec 2022 16:38:47 -0500 Subject: [PATCH 1/3] colinwm-combobox-commit --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 220a35f..3a15a6f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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, originalEvent?: MouseEvent): void { + target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, originalEvent})) } function visible(el: HTMLElement): boolean { From f69db8c7bf3808952e75e5df5754596e92bbcc83 Mon Sep 17 00:00:00 2001 From: Colin Merkel Date: Mon, 12 Dec 2022 16:41:37 -0500 Subject: [PATCH 2/3] colinwm-combobox-commit --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 3a15a6f..47e7f66 100644 --- a/src/index.ts +++ b/src/index.ts @@ -185,7 +185,7 @@ function commit(input: HTMLTextAreaElement | HTMLInputElement, list: HTMLElement } function fireCommitEvent(target: Element, originalEvent?: MouseEvent): void { - target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, originalEvent})) + target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail: {originalEvent}})) } function visible(el: HTMLElement): boolean { From 9daad1b0c407d2c3cb38306299fe216a455c5813 Mon Sep 17 00:00:00 2001 From: Colin Merkel Date: Tue, 13 Dec 2022 10:59:01 -0500 Subject: [PATCH 3/3] colinwm-combobox-commit --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 47e7f66..1f4d5f1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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, event) + 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, originalEvent?: MouseEvent): void { - target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail: {originalEvent}})) +function fireCommitEvent(target: Element, detail?: Record): void { + target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail})) } function visible(el: HTMLElement): boolean {