Skip to content

Commit

Permalink
Fix select-keyboard-behavior timeout
Browse files Browse the repository at this point in the history
Hopefully adding a long timeout tag with additional rAFs fixes these
timeouts. A similar fix was done here:
https://chromium-review.googlesource.com/c/chromium/src/+/5463903

Bug: 335324883
Fixed: 331736581
Change-Id: Ie1b2faa1a761ce4a039f95e9ca03646b99ea9813
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5466540
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1289562}
  • Loading branch information
josepharhar authored and Chromium LUCI CQ committed Apr 18, 2024
1 parent e7443b2 commit cfa3d5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 0 additions & 3 deletions third_party/blink/web_tests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -2633,9 +2633,6 @@ crbug.com/626703 [ Mac ] external/wpt/mediacapture-insertable-streams/legacy/Med
crbug.com/626703 external/wpt/uievents/mouse/mouse_boundary_events_after_removing_last_over_element.html [ Failure ]

# ====== New tests from wpt-importer added here ======
crbug.com/335324883 [ Mac12 ] external/wpt/html/semantics/forms/the-select-element/stylable-select/select-keyboard-behavior.tentative.html [ Timeout ]
crbug.com/335324883 [ Mac14 ] external/wpt/html/semantics/forms/the-select-element/stylable-select/select-keyboard-behavior.tentative.html [ Timeout ]
crbug.com/335324883 [ Mac13 ] external/wpt/html/semantics/forms/the-select-element/stylable-select/select-keyboard-behavior.tentative.html [ Timeout ]
crbug.com/335330795 [ Mac14 ] virtual/webnn-service-with-gpu/external/wpt/webnn/conformance_tests/gpu/reduction.https.any.worker.html [ Skip Timeout ]
crbug.com/335246098 external/wpt/css/css-viewport/zoom/iframe-zoom-nested.html [ Failure ]
crbug.com/335246098 external/wpt/css/css-viewport/zoom/iframe-zoom.sub.html [ Failure ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
<meta name=timeout content=long>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1422275">
<link rel=help href="https://github.com/openui/open-ui/issues/433#issuecomment-1452461404">
Expand Down Expand Up @@ -68,6 +69,7 @@

async function closeListbox() {
await test_driver.click(select);
await new Promise(requestAnimationFrame);
}

function addCloseCleanup(t) {
Expand Down Expand Up @@ -96,6 +98,7 @@
assert_false(select.matches(':open'),
'The select should initially be closed.');
await test_driver.send_keys(document.activeElement, Space);
await new Promise(requestAnimationFrame);
assert_true(select.matches(':open'),
'The select should be open after pressing space.');
}, `${id}: When the listbox is closed, spacebar should open the listbox.`);
Expand All @@ -108,27 +111,31 @@
'The select should initially be closed.');

await test_driver.send_keys(document.activeElement, ArrowLeft);
await new Promise(requestAnimationFrame);
assert_true(select.matches(':open'),
'Arrow left should open the listbox.');
assert_equals(select.value, 'two',
'Arrow left should not change the selected value.');
await closeListbox();

await test_driver.send_keys(document.activeElement, ArrowUp);
await new Promise(requestAnimationFrame);
assert_true(select.matches(':open'),
'Arrow up should open the listbox.');
assert_equals(select.value, 'two',
'Arrow up should not change the selected value.');
await closeListbox();

await test_driver.send_keys(document.activeElement, ArrowRight);
await new Promise(requestAnimationFrame);
assert_true(select.matches(':open'),
'Arrow right should open the listbox.');
assert_equals(select.value, 'two',
'Arrow right should not change the selected value.');
await closeListbox();

await test_driver.send_keys(document.activeElement, ArrowDown);
await new Promise(requestAnimationFrame);
assert_true(select.matches(':open'),
'Arrow down should open the listbox.');
assert_equals(select.value, 'two',
Expand All @@ -147,6 +154,7 @@
} else {
await test_driver.send_keys(select, Enter);
}
await new Promise(requestAnimationFrame);
assert_false(select.matches(':open'),
'Enter should not open the listbox when outside a form.');

Expand All @@ -161,6 +169,7 @@
} else {
await test_driver.send_keys(select, Enter);
}
await new Promise(requestAnimationFrame);
assert_true(formWasSubmitted,
'Enter should submit the form when the listbox is closed.');
assert_false(select.matches(':open'),
Expand All @@ -175,30 +184,35 @@

select.value = 'two';
await test_driver.click(select);
await new Promise(requestAnimationFrame);
assert_true(select.matches(':open'),
'The select should open when clicked.');
assert_equals(document.activeElement, optionTwo,
'The selected option should receive initial focus.');

await test_driver.send_keys(document.activeElement, ArrowDown);
await new Promise(requestAnimationFrame);
assert_equals(document.activeElement, optionThree,
'The next option should receive focus when the down arrow key is pressed.');
assert_equals(select.value, 'two',
'The selects value should not change when focusing another option.');

await test_driver.send_keys(document.activeElement, ArrowUp);
await new Promise(requestAnimationFrame);
assert_equals(document.activeElement, optionTwo,
'The previous option should receive focus when the up arrow key is pressed.');
assert_equals(select.value, 'two',
'The selects value should not change when focusing another option.');

await test_driver.send_keys(document.activeElement, ArrowUp);
await new Promise(requestAnimationFrame);
assert_equals(document.activeElement, optionOne,
'The first option should be selected.');
assert_equals(select.value, 'two',
'The selects value should not change when focusing another option.');

await test_driver.send_keys(document.activeElement, Enter);
await new Promise(requestAnimationFrame);
assert_false(select.matches(':open'),
'The listbox should be closed after pressing enter.');
assert_equals(select.value, 'one',
Expand Down

0 comments on commit cfa3d5b

Please sign in to comment.