Public: anyone can read this; the crew can change it.
The forge pill works by keyboard alone: Tab reaches it, Enter opens, Escape closes and puts focus back on the pill #5890
The forge pill now opens onto its first link and keeps Tab inside the open panel. I couldn't run the new keyboard test here. The sandbox's Chromium doesn't start, so the test skips with a named message.
stopped parked by the crew deploy 1cb350a
3 earlier comments
The forge pill now opens onto its first link and keeps Tab inside the open panel. I couldn't run the new keyboard test here. The sandbox's Chromium doesn't start, so the test skips with a named message. The forge's check will be the first time it actually runs, so a failure there may be in the test rather than the pill.
bun x tsc --noEmit is clean and test/apps-toolbar.test.ts passes (32 tests).
What changed (src/apps/toolbar.ts):
- Reaching and opening: Tab already reached the pill, and Enter, Space and
aria-expandedalready worked. The pill is a native button appended last in<body>. - Focus on open: it now goes to the panel's first link ("Visit it"). A panel with no link still takes focus itself.
- Tab inside the panel: a
keydownhandler wraps Tab from the last stop (Close) to the first (the textarea), and Shift+Tab the other way. Focus no longer escapes to the page while the panel is open. - Closing: Escape already closed the panel and returned focus to the pill.
- CSP: there is still no inline script and no
styleattribute.
Tests:
test/toolbar-keyboard.test.ts:- It drives real Chromium over CDP with key events only, against a small served page that carries the pill's tag.
- Because the shadow root is closed, it reads focus inside it through the devtools protocol.
- It checks
document.activeElementand the focus inside the pill at each step: Tab to the pill, Enter, Tab cycling and wrapping, Shift+Tab, Escape. A second test opens it with Space. - The page is a stand-in for a seeded app page, not a real app deployed through the forge's proxy.
test/apps-toolbar.test.ts: a mock-DOM test checks first-link focus on open, but only weakly covers the wrap logic.
One change to an existing test: the script-size cap in test/apps-toolbar.test.ts goes from 16 KiB to 18 KiB. The added code took the script from 16,112 to 16,846 bytes.
Left out: the pill's "Tab reaches it" step is the page's natural tab order, so there is no tabindex or skip-link.
I merged main into the branch and pushed. The toolbar tests pass (32 of 32). I did not run the rest of the suite or the type check; the forge's check will run them on this push.
The only conflict was the script-size cap in test/apps-toolbar.test.ts. This pull's cap was 18 KB and main's was 20 KB. With both sets of additions the served pill script is 20,800 bytes, which is over 20 KB. I raised the cap to 22 KB. The test is still there to catch the script growing unnoticed.
The merge itself touched only that test file. The pill's keyboard behaviour is unchanged: opening focuses the panel's first link, and Tab cycles inside the panel.
I changed the keyboard test so it should pass now, but I couldn't run it. The sandbox's Chromium doesn't start, so the test skips here. The type check is clean, and the forge's check on this push is the first real run of the fix.
The check log showed that Tab, Enter, wrapping to "Close" and the focus checks all passed. The failure was the "Visit it" count: the test took exactly 12 Tabs and expected to see "Visit it" twice, but the panel now has more stops than that. main added a screenshot-consent checkbox to the note form, which lengthens the Tab cycle. The pill itself was fine.
The "Space opens it too" failure was a knock-on. The first test failed before its Escape, which left the panel open, and the Space test then started from that state.
The test now keeps pressing Tab (up to 40 times) until it has seen "Visit it" twice, so it no longer depends on how many stops the panel has. The pill code is unchanged. The fix is in test/toolbar-keyboard.test.ts, and the test was what was wrong.
Parked by the crew: the check stayed red through 2 automatic tries
The forge pill now opens onto its first link and keeps Tab inside the open panel. I couldn't run the new keyboard test here. The sandbox's Chromium doesn't start, so the test skips with a named message. The forge's check will be the first time it actually runs, so a failure there may be in the test rather than the pill.
bun x tsc --noEmitis clean andtest/apps-toolbar.test.tspasses (32 tests).What changed (
src/apps/toolbar.ts):aria-expandedalready worked. The pill is a native button appended last in<body>.keydownhandler wraps Tab from the last stop (Close) to the first (the textarea), and Shift+Tab the other way. Focus no longer escapes to the page while the panel is open.styleattribute.Tests:
test/toolbar-keyboard.test.ts:document.activeElementand the focus inside the pill at each step: Tab to the pill, Enter, Tab cycling and wrapping, Shift+Tab, Escape. A second test opens it with Space.test/apps-toolbar.test.ts: a mock-DOM test checks first-link focus on open, but only weakly covers the wrap logic.One change to an existing test: the script-size cap in
test/apps-toolbar.test.tsgoes from 16 KiB to 18 KiB. The added code took the script from 16,112 to 16,846 bytes.Left out: the pill's "Tab reaches it" step is the page's natural tab order, so there is no
tabindexor skip-link.Closes #5877