You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit da77507
Browse filesBrowse the repository at this point in the historyBrowse files
fix(a11y): a sidebar search answered after focus left it repaints its results but does not reopen them around someone elsewhere (review F3.5 of QA third pass D10)
Leaving the search - Tab out (F2.7) or Escape (D10) - closed the panel,
but a query still in its 140 ms debounce or in flight then answered, and
renderGsearch ended with gsearchOpen: the panel reopened with focus on the
Dashboard tab, its up-to-50 hits tabbable ahead of the sidebar's tabs,
until a click elsewhere. After an Escape a second Escape no longer reached
the box's handler.
gsearchOpen now opens the results only while focus is inside the search.
The answer still repaints the panel, so entering the box again opens it on
the answer to what the box says. Cancelling the search on leave (the
review's suggestion) was not taken: the panel would keep the older answer
behind the newer text, for the focus handler to reopen and Enter to open.
Test: frontendContract's search harness now holds the debounce timers and
each request for the test to run and answer (counted steps, no clock), and
starts the panel hidden as the page does. The test types and Tabs out
inside the debounce, Escapes inside it, Tabs out with a request in flight,
and has a failed request answer after Escape: the panel stays closed,
aria-expanded stays false and focus stays put; entering the box again
opens it on "foo"'s answer, not "fo"'s. Eight hand mutants (no guard, the
review's cancel shape, a cancel kept beside the guard, the failure path
opening directly, aria-expanded set before the guard, a guard that pulls
focus back, the focus handler not reopening, a guard that never opens),
all RED, each file restored by SHA-256.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test('Escape in the sidebar search gives focus back to where it came from — never to <body> (QA third pass D10)',()=>{
@@ -1380,6 +1402,63 @@ test('Escape on a sidebar search result leaves the search as Escape in the box d
1380
1402
assert.equal(t.els.gsearchResults.hidden,false,'focus going nowhere on the page — another window — leaves them as they were');
1381
1403
});
1382
1404
1405
+
test('a search answered after focus left the sidebar search does not reopen its results around someone elsewhere — and coming back shows that answer (review F3.5 of QA third pass D10)',async()=>{
1406
+
// Type "foo" and Tab out within the 140 ms debounce: the focusout closed the
1407
+
// panel, then the timer fired, the answer came back, and renderGsearch
1408
+
// reopened it — with focus on the Dashboard tab, its hits tabbable ahead of
1409
+
// the tab list, until a click elsewhere. Escape inside the debounce, and a
1410
+
// Tab out while a request was in flight, did the same.
1411
+
constt=gsearchHarness({viewControl: true});
1412
+
t.focusBox(t.elsewhere);
1413
+
t.type('foo');
1414
+
t.viewControl.focus();
1415
+
t.fire(t.els.gsearch,'focusout',{relatedTarget: t.viewControl});// Tab: out of the search, before the debounce ran out
1416
+
assert.equal(t.els.gsearchResults.hidden,true,'control: leaving closed the results');
1417
+
t.elapse();
1418
+
assert.equal(t.asked.length,1,'control: the search still ran');
1419
+
awaitt.answer(0,['foo.zip']);
1420
+
assert.equal(t.els.gsearchResults.hidden,true,'its answer does not reopen the results around a person who has left');
1421
+
assert.equal(t.els.gsearch.attrs['aria-expanded'],'false','and the box does not say they are open');
1422
+
1423
+
// Escape inside the debounce: focus goes back where it came from, and the answer leaves it there.
1424
+
conste=gsearchHarness({viewControl: true});
1425
+
e.focusBox(e.elsewhere);
1426
+
e.type('foo');
1427
+
e.escape();
1428
+
e.elapse();
1429
+
awaite.answer(0,['foo.zip']);
1430
+
assert.equal(e.els.gsearchResults.hidden,true,'Escape left the search, and the late answer does not reopen it');
1431
+
assert.equal(e.doc.active,e.elsewhere,'focus stays where Escape put it');
1432
+
1433
+
// Results showing, one more letter, Tab out while that search is in flight.
1434
+
constf=gsearchHarness({viewControl: true});
1435
+
f.focusBox(f.elsewhere);
1436
+
f.type('fo');
1437
+
f.elapse();
1438
+
awaitf.answer(0,['fo.txt']);
1439
+
assert.equal(f.els.gsearchResults.hidden,false,'control: an answer for someone in the box opens the results');
0 commit comments