fix(dashboard): reveal script-focused rail cards after a mouse click

The input modality stays "mouse" after any click, so a later focus() on
a partly hidden card left it clipped. The rail now skips the reveal only
for focus caused by a press inside the track: the focus has to arrive
within 100ms of that pointerdown (650ms for touch, whose focus comes
with the tap's compatibility mouse events, as in the CDK FocusMonitor).
Only event timestamps are compared, so the DOM still stays untouched
before the click.

The E2E now clicks elsewhere before the script focus, and unit tests
cover a tap and focus() after an earlier mouse press.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-10-01 23:09:32 +02:00
1 parent 58e6c3a853
commit 31ea629e2e
4 files changed
+93 -34

No files matched your search

@@ -120,7 +120,9 @@ test.describe('Dashboard rail focus', () => {
expect(await lastCardLinkFocused(app.mainWindow)).toBe(true);
await expect.poll(() => lastCardFullyVisible(rail)).toBe(true);
// `focus()` from script, starting at the rail's start again.
// `focus()` from script after a mouse click elsewhere, starting
// at the rail's start again.
await rail.locator('.rail__label').click();
await rail.evaluate((section) => {
(document.activeElement as HTMLElement | null)?.blur();
section