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
disablerd form controls to dblclick in addition to click, mouseup, and
mousedown:
whatwg/html#2368 (comment)

Change-Id: Ibc52585ce0704d8ba8467efc3462bd378d23fbae
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Nov 9, 2023
1 parent cf4a0be commit bf9d39f
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 bf9d39f

Please sign in to comment.