fix(frontend): make NavSessions rows keyboard-accessible (role/tabIndex/Enter+Space)
This commit is contained in:
@@ -25,3 +25,12 @@ test("active session is highlighted", () => {
|
||||
render(<NavSessions sessions={SESSIONS} activeSessionId="s2" onOpenPanel={vi.fn()} menuFor={() => null} />);
|
||||
expect(screen.getByTestId("session-item-s2")).toHaveAttribute("data-active", "true");
|
||||
});
|
||||
|
||||
test("pressing Enter on a focused row opens the panel", async () => {
|
||||
const onOpenPanel = vi.fn();
|
||||
render(<NavSessions sessions={SESSIONS} activeSessionId={null} onOpenPanel={onOpenPanel} menuFor={() => null} />);
|
||||
const row = screen.getByTestId("session-item-s1");
|
||||
row.focus();
|
||||
await userEvent.keyboard("{Enter}");
|
||||
expect(onOpenPanel).toHaveBeenCalledWith("s1");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user