From 1f1cbd30d5f65ff565370c85f8e7c9366d3c9e77 Mon Sep 17 00:00:00 2001 From: Kohei Yoshino Date: Wed, 10 Jan 2024 16:41:51 -0500 Subject: [PATCH] Restore part of code for Selenium --- js/components/select.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/components/select.js b/js/components/select.js index 777b3a7bf3..c967f7f0ef 100644 --- a/js/components/select.js +++ b/js/components/select.js @@ -609,7 +609,9 @@ class BzSelectElement extends HTMLElement { } /** - * Called whenever the {@link #dialog} is clicked. Hide the dropdown list. + * Called whenever the {@link #dialog} is clicked. Hide the dropdown list, and select a new option + * if possible. Usually {@link #onListboxMouseUp} handles selection, but the code is needed to + * pass the Selenium tests using `click` events. * @param {MouseEvent} event `click` event. */ #onDialogClick(event) { @@ -617,6 +619,11 @@ class BzSelectElement extends HTMLElement { if (target === this) { this.#hideDropdown(); + } else if (target.matches('bz-option:not([disabled])')) { + this.#hideDropdown(); + this.#canDispatchEvent = true; + this.value = target.value; + this.#canDispatchEvent = false; } }