fix(player): a held key on faded bands stays one blind press; a play asked for mid-restart is the new session's

The repeats of a Space/Enter that landed on faded bands pressed the control once the bands were up;
they are swallowed with it. A play or pause while a session restart is out now sets that session's
intent instead of playing the outgoing stream. Tests: Skip intro outside the bands keeps its keys,
every restore takeover (wheel, finger, scrollbar, key) is covered, and the chip handoff test tells
the chip before from the row's first control.
This commit is contained in:
2026-09-27 22:34:14 +02:00
parent 528774d640
commit d5ccb1091a
4 changed files with 173 additions and 29 deletions
+8 -7
View File
@@ -71,10 +71,10 @@ describe("Chip", () => {
});
// Round 3: the neighbour it hands the focus to can go in the same removal — the "Clear all" that
// only shows beside two filters. The focus then goes to the chip before, not to <body>.
// only shows beside enough filters. The focus then goes to the chip before, not to <body>.
it("a removing chip whose neighbour goes with it hands the focus to the chip before", async () => {
function Row() {
const [chips, setChips] = useState(["Music", "News"]);
const [chips, setChips] = useState(["Music", "News", "Sport"]);
return (
<div>
{chips.map((c) => (
@@ -87,17 +87,18 @@ describe("Chip", () => {
{c}
</Chip>
))}
{chips.length > 1 && <button onClick={() => setChips([])}>Clear all</button>}
{chips.length > 2 && <button onClick={() => setChips([])}>Clear all</button>}
</div>
);
}
render(<Row />);
const news = screen.getByRole("button", { name: "Remove News" });
act(() => news.focus());
fireEvent.click(news, { detail: 0 });
const sport = screen.getByRole("button", { name: "Remove Sport" });
act(() => sport.focus());
fireEvent.click(sport, { detail: 0 });
expect(screen.queryByRole("button", { name: "Clear all" })).toBeNull();
// the chip right before it — not the row's first control, which Music also is
await waitFor(() =>
expect(document.activeElement).toBe(screen.getByRole("button", { name: "Remove Music" })),
expect(document.activeElement).toBe(screen.getByRole("button", { name: "Remove News" })),
);
});