forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interactive elements in customizable select picker
MenuListSelectType::DefaultEventHandler has code which may focus the select element, show/hide the picker, and prevent other default event handlers from running. This code runs when clicking anything in the picker since we aren't looking at the event path anymore. This results in interactive elements not being clickable/focusable in the picker. This patch fixes this by not running any of this code while the base appearance picker is open. This likely stopped working when the PopoverButtonNestingBehavior flag was used in MenuListSelectType::DefaultEventHandler because the old code there which no longer gets run would also prevent the DefaultEventHandler from doing anything in this case. Change-Id: I5240766badaa0025072bf3123e5dd9f18466de99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6240329 Reviewed-by: Traian Captan <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1420083}
- Loading branch information
1 parent
399d4ad
commit 2b5429e
Showing
3 changed files
with
68 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
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
50 changes: 50 additions & 0 deletions
50
...select-element/customizable-select/select-picker-interactive-element-focus.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,50 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:[email protected]"> | ||
<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> | ||
|
||
<select> | ||
<button>invoker</button> | ||
<button id=button>button</button> | ||
<option>option</option> | ||
</select> | ||
|
||
<style> | ||
select, ::picker(select) { | ||
appearance: base-select; | ||
} | ||
</style> | ||
|
||
<script> | ||
function click(element) { | ||
return (new test_driver.Actions() | ||
.pointerMove(1, 1, {origin: element}) | ||
.pointerDown() | ||
.pointerUp()) | ||
.send(); | ||
} | ||
|
||
promise_test(async () => { | ||
const select = document.querySelector('select'); | ||
const button = document.getElementById('button'); | ||
const input = document.createElement('input'); | ||
select.appendChild(input); | ||
|
||
await click(select); | ||
assert_true(select.matches(':open'), | ||
'select should open after being clicked.'); | ||
|
||
await click(button); | ||
assert_true(select.matches(':open'), | ||
'select should stay open after clicking button in picker.'); | ||
assert_equals(document.activeElement, button, 'button'); | ||
|
||
await click(input); | ||
assert_true(select.matches(':open'), | ||
'select should stay open after clicking input in picker.'); | ||
assert_equals(document.activeElement, input, 'input'); | ||
}, 'Clicking interactive elements inside the select picker should focus them.'); | ||
</script> |