mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Let a quick second click on Next move on, and Tab leave the welcome for the page
The second click of a double click on NEXT was dropped, so the button looked dead; it now moves to the next step, and only the launch itself still takes a single click. Tab from the search bar or another control jumped back into the card; the card no longer claims focus from the page, and still takes it when focus has nowhere else to be. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
4d42c56bdf
commit
866eadbe5e
6 files changed
+77
-6
No files matched your search
@@ -2,7 +2,7 @@ import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createSurfaceKeyboard } from './surfaceKeyboard.js';
|
||||
|
||||
function fixture() {
|
||||
function fixture({ claimOutsideFocus } = {}) {
|
||||
const listeners = new Set();
|
||||
const documentRef = {
|
||||
activeElement: null,
|
||||
@@ -54,6 +54,7 @@ function fixture() {
|
||||
isActive: () => visible,
|
||||
onEscape: () => onEscape(),
|
||||
fallbackFocus: () => fallback,
|
||||
claimOutsideFocus,
|
||||
});
|
||||
opener.focus();
|
||||
const event = (key, extra = {}) => ({
|
||||
@@ -134,6 +135,23 @@ test('Tab enters from outside in either direction and wraps only at an edge', ()
|
||||
);
|
||||
});
|
||||
|
||||
test('a surface that does not claim outside focus leaves Tab to the page', () => {
|
||||
const f = fixture({ claimOutsideFocus: false });
|
||||
f.controller.activate();
|
||||
// From a control outside (the search bar), Tab follows the page.
|
||||
f.opener.focus();
|
||||
assert.equal(f.send('Tab').defaultPrevented, false);
|
||||
assert.equal(f.send('Tab', { shiftKey: true }).defaultPrevented, false);
|
||||
assert.equal(f.documentRef.activeElement, f.opener);
|
||||
// Focus with nowhere to be still moves in, and wraps inside as before.
|
||||
f.documentRef.activeElement = null;
|
||||
assert.equal(f.send('Tab').defaultPrevented, true);
|
||||
assert.equal(f.documentRef.activeElement, f.first);
|
||||
f.last.focus();
|
||||
f.send('Tab');
|
||||
assert.equal(f.documentRef.activeElement, f.first);
|
||||
});
|
||||
|
||||
test('Tab uses current controls and skips hidden/disabled nodes without changing native middle movement', () => {
|
||||
const f = fixture();
|
||||
f.controller.activate();
|
||||
|
||||
Reference in new issue
Block a user