script: retarget dblclick from input UA shadow DOM to host (#41319)

dblclick on text inputs was being dispatched to an internal element used
for the input, not to the <input> itself. As a result, page scripts
listening for dblclick on the input never received the event.

Testing: tested manually.
Fixes: #41303

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi
2025-12-18 14:09:35 +01:00
committed by GitHub
parent 581723c338
commit 25a626cf3d
3 changed files with 57 additions and 0 deletions

View File

@@ -684,6 +684,9 @@ impl DocumentEventHandler {
// > The click event type MUST be dispatched on the topmost event target indicated by the
// > pointer, when the user presses down and releases the primary pointer button.
// For nodes inside a text input UA shadow DOM, dispatch dblclick at the shadow host.
let delegated = element.find_focusable_shadow_host_if_necessary();
let element = delegated.as_deref().unwrap_or(element);
self.most_recently_clicked_element.set(Some(element));
element.set_click_in_progress(true);