commit 820cd415d8aef49f010c1d8638ef077c5305ddfd
parent 5226434972b855ae4ec3c5a98ebddd8fc36f794c
Author: Joey Arhar <jarhar@chromium.org>
Date: Tue, 21 Oct 2025 10:38:32 +0000
Bug 1995369 [wpt PR 55551] - Fix customizable select mousedown tracking on touch, a=testonly
Automatic update from web-platform-tests
Fix customizable select mousedown tracking on touch
The mousedown tracking code which prevents one click from opening and
then closing the picker when the picker is rendered on top of the
select's invoker was not used for touch input because I thought that
mousedown and mouseup would both be fired on the select element.
However, the touch input code runs a hit test in between mousedown and
mouseup for a gesturetap input, so the mouseup would actually land on
the option in the picker in this case and cause the picker to open and
close in one tap.
This patch fixes the bug by removing the special case to not do
mousedown tracking for touch input.
Fixed: 452084008
Change-Id: Ia03dbb91a2c8d54eb4f1bb134ffffb91e046b93a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7055343
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1532501}
--
wpt-commits: 2ea8eef3ca88f44e5063c4accefe7916fd2dbace
wpt-pr: 55551
Diffstat:
1 file changed, 46 insertions(+), 34 deletions(-)
diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/customizable-select/select-click-drag-option.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/customizable-select/select-click-drag-option.html
@@ -82,41 +82,53 @@ promise_test(async () => {
'select.value should be changed to one after releasing the pointer on the first option.');
}, 'Clicking the invoker button and dragging to an option should choose that option and close the picker.');
-promise_test(async () => {
- assertAppearance();
- const select = document.getElementById('s2');
- const optionOne = select.querySelector('.one');
- const optionTwo = select.querySelector('.two');
- assert_false(select.matches(':open'),
- 'select should be closed at the start of the test.');
+[false, true].forEach(isTouch => {
+ promise_test(async () => {
+ assertAppearance();
+ const select = document.getElementById('s2');
+ const optionOne = select.querySelector('.one');
+ const optionTwo = select.querySelector('.two');
+ assert_false(select.matches(':open'),
+ 'select should be closed at the start of the test.');
- await (new test_driver.Actions()
- .pointerMove(2, 2, {origin: select})
- .pointerDown()
- .pointerMove(2, 2, {origin: optionOne})
- .pointerUp())
- .send();
- assert_true(select.matches(':open'),
- 'select should still be open after pointerUp() without moving the pointer.');
+ let actions = new test_driver.Actions();
+ if (isTouch) {
+ actions.addPointer('finger', 'touch');
+ }
+ await (actions
+ .pointerMove(2, 2, {origin: select})
+ .pointerDown()
+ .pointerUp())
+ .send();
+ assert_true(select.matches(':open'),
+ 'select should still be open after pointerUp() without moving the pointer.');
- await (new test_driver.Actions()
- .pointerMove(2, 2, {origin: optionOne})
- .pointerDown()
- .pointerUp())
- .send();
- assert_false(select.matches(':open'),
- 'select should close after clicking option on top of the invoker.');
+ actions = new test_driver.Actions();
+ if (isTouch) {
+ actions.addPointer('finger', 'touch');
+ }
+ await (actions
+ .pointerMove(2, 2, {origin: optionOne})
+ .pointerDown()
+ .pointerUp())
+ .send();
+ assert_false(select.matches(':open'),
+ 'select should close after clicking option on top of the invoker.');
- await (new test_driver.Actions()
- .pointerMove(2, 2, {origin: select})
- .pointerDown()
- .pointerMove(2, 2, {origin: optionOne})
- .pointerMove(2, 2, {origin: optionTwo})
- .pointerUp())
- .send();
- assert_false(select.matches(':open'),
- 'select should close after clicking and dragging to second option.');
- assert_equals(select.value, 'two',
- 'select.value should change two after choosing the second option.');
-}, 'Releasing the pointer on an option positioned on top of the invoker button should not close the picker.');
+ // Click and drag isn't supported on touch.
+ if (!isTouch) {
+ await (new test_driver.Actions()
+ .pointerMove(2, 2, {origin: select})
+ .pointerDown()
+ .pointerMove(2, 2, {origin: optionOne})
+ .pointerMove(2, 2, {origin: optionTwo})
+ .pointerUp())
+ .send();
+ assert_false(select.matches(':open'),
+ 'select should close after clicking and dragging to second option.');
+ assert_equals(select.value, 'two',
+ 'select.value should change two after choosing the second option.');
+ }
+ }, `${isTouch ? 'touch' : 'mouse'}: Releasing the pointer on an option positioned on top of the invoker button should not close the picker.`);
+});
</script>