Skip to content

Commit

Permalink
Don't fire dblclick on disabled form control elements
Browse files Browse the repository at this point in the history
As discussed here, we should apply the event blocking behavior for
disabled form controls to dblclick in addition to click, mouseup, and
mousedown:
whatwg/html#2368 (comment)

Change-Id: Ibc52585ce0704d8ba8467efc3462bd378d23fbae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5007308
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1225838}
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Nov 17, 2023
1 parent 4c9fdd1 commit 81de9c0
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
static get formAssociated() { return true; }
});

['mousedown', 'mouseup', 'pointerdown', 'pointerup', 'click'].forEach(eventName => {
['mousedown', 'mouseup', 'pointerdown', 'pointerup', 'click', 'dblclick'].forEach(eventName => {
[true, false].forEach(clickChildElement => {
for (const target of targetparent.children) {
promise_test(async () => {
Expand All @@ -39,7 +39,18 @@
let targetchild = target.firstElementChild;
targetchild.addEventListener(eventName, () => childReceivedEvent = true);

await test_driver.click(clickChildElement ? targetchild : target);
const elementToClick = clickChildElement ? targetchild : target;
if (eventName === 'dblclick') {
await (new test_driver.Actions()
.pointerMove(1, 1, {origin: elementToClick})
.pointerDown()
.pointerUp()
.pointerDown()
.pointerUp())
.send();
} else {
await test_driver.click(elementToClick);
}

const parentShouldReceiveEvents = eventName.startsWith('pointer');
assert_equals(parentReceivedEvent, parentShouldReceiveEvents,
Expand Down

0 comments on commit 81de9c0

Please sign in to comment.