fix(story-mode): focus returns to the chip that opened the drawer; document this round's fields

- The final panel's chips were rebuilt on every redraw, so the chip that
  opened a drawer was gone by the time it closed and focus fell to the
  page body. Unchanged chips are now kept, and a trigger replaced anyway
  hands focus to the control that opens the same thing.
- API reference: `older`, background Bash calls (`running`), `subject`,
  append hunks (`atEnd`), `files` resolved against the command's folder,
  test counts read before the output is cut, `roundsOk`, the `note`
  speaker and `noneWorked`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-18 12:57:58 +02:00
1 parent 6a1bac6ebe
commit d92e927184
3 files changed
+48 -18

No files matched your search

+20
View File
@@ -563,6 +563,26 @@ describe('story-mode.js overlay', () => {
expect($$('.story-ln--add').map((l) => l.textContent)).toEqual(['+more']);
});
it('a chip that opened the drawer takes focus back, even when the page was redrawn meanwhile', async () => {
boot(storyOf(demoTurn()));
app.openStoryMode(SID);
await settle();
sizeAndDraw();
const chip = $$('.story-chips button').find((b) => b.dataset.storyOpen === 'diff:page')!;
chip.focus();
chip.click();
expect($('.story-drawer-kind')!.textContent).toBe('Diff');
// A redraw with the same chips keeps the same element.
app._storyRender();
expect(win.document.contains(chip)).toBe(true);
// One that did replace it: focus goes to the chip that opens the same thing.
const twin = chip.cloneNode(true) as HTMLElement;
chip.replaceWith(twin);
press('Escape');
expect($('.story-drawer')!.hidden).toBe(true);
expect(win.document.activeElement).toBe(twin);
});
it('while a question waits, the pencils say so; the chosen answer is marked, not struck', async () => {
const ask = (answered: boolean) =>
storyOf([