-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent fieldsets from being disabled form controls
Fieldset elements themselves aren't actually supposed to be disabled form controls, they are just supposed to make their descendant field control elements disabled: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-disabled This was causing a bug where SendMouseEventsDisabledFormControls prevents click/mouseup/mousedown events from being propagated at or above disabled fieldset elements. Fixed: 1422096, 1422547 Bug: 588760 Change-Id: Ifb76ac92f7f36b097666b4384f6de4bd561547cd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4321065 Reviewed-by: Mason Freed <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1122658}
- Loading branch information
1 parent
02ed58b
commit de685a7
Showing
4 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
html/semantics/disabled-elements/fieldset-event-propagation.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:[email protected]"> | ||
<link rel=help href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-disabled"> | ||
<link rel=help href="https://github.com/whatwg/html/issues/5886#issuecomment-1460425364"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/testdriver-actions.js"></script> | ||
|
||
<div id=target1parent> | ||
<fieldset disabled id=target1fieldset> | ||
<div id=target1child>hello world</div> | ||
</fieldset> | ||
</div> | ||
|
||
<div id=target2parent> | ||
<fieldset disabled id=target2fieldset>hello world</div> | ||
</div> | ||
|
||
<script> | ||
promise_test(async () => { | ||
let target1parentClicked = false; | ||
let target1childClicked = false; | ||
let target1fieldsetClicked = false; | ||
target1parent.onclick = () => target1parentClicked = true; | ||
target1child.onclick = () => target1childClicked = true; | ||
target1fieldset.onclick = () => target1fieldsetClicked = true; | ||
|
||
await test_driver.click(target1child); | ||
|
||
assert_true(target1parentClicked, 'The parent of the fieldset should receive a click event.'); | ||
assert_true(target1childClicked, 'The child of the fieldset should receive a click event.'); | ||
assert_true(target1fieldsetClicked, 'The fieldset element should receive a click event.'); | ||
}, 'Disabled fieldset elements should not prevent click event propagation.'); | ||
|
||
promise_test(async () => { | ||
let target2parentClicked = false; | ||
let target2fieldsetClicked = false; | ||
target2parent.onclick = () => target2parentClicked = true; | ||
target2fieldset.onclick = () => target2fieldsetClicked = true; | ||
|
||
await test_driver.click(target2fieldset); | ||
|
||
assert_true(target2parentClicked, 'The parent of the fieldset should receive a click event.'); | ||
assert_true(target2fieldsetClicked, 'The fieldset element should receive a click event.'); | ||
}, 'Disabled fieldset elements should not block click events.'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters