Repository navigation
Description
Summary
The Dashboard type-to-filter hotkey (/, trinity-enterprise#261) is not listening when the fleet first paints. A / pressed in that window is silently dropped. User impact is small (~50ms); test impact is total — all 7 dashboard-type-filter specs fail deterministically.
Context
Found during an exploratory E2E sweep of dev @ c1cc22bc, measured by instrumenting document.addEventListener:
[data-agent="trinity-system"] visible at t = 261 ms
handleDashboardKeydown registered at t = 311 ms
The fleet is painted by a child component; the hotkey is registered in the parent's onMounted, which Vue always runs after children mount. So there is a window in which the dashboard looks fully interactive but the document-level handler does not exist yet. The event reaches document with defaultPrevented: false and nothing consumes it.
Probe matrix (fresh browser context per row):
| Scenario | Pill opens? |
|---|---|
press / immediately |
❌ |
press / twice |
❌ then ✅ |
wait 6s, then press / |
✅ |
click body, then press / |
❌ — it is time, not focus |
click the toolbar / button |
✅ (direct @click, bypasses the document handler) |
The feature itself is correct once armed: it filters by slug and display label, reports "1 of 7 match", and Esc restores.
Why it matters beyond the 50ms: Playwright acts the instant its waitFor resolves, so the suite hits this window every run. All 7 specs in e2e/dashboard-type-filter.spec.js fail on getByTestId('filter-pill') not found. The spec's own docstring warns about a focus race one level lower down; the actual race is the listener registration.
Acceptance Criteria
- Pressing
/immediately after the fleet renders opens the filter pill - The document keydown handler is armed no later than the point at which agent tiles/rows are visible
- All 7 specs in
e2e/dashboard-type-filter.spec.jspass without an artificialwaitForTimeout - Existing guards preserved:
/in an editable field still types a literal slash; Esc backstop still clears; nothing persists across reload
Technical Notes
src/frontend/src/views/Dashboard.vue—handleDashboardKeydownregistered inonMounted(~line 868); guards 0–5 are correct and not the problem- Options: register the listener earlier in setup rather than
onMounted, or expose a readiness signal the tests (and the UI) can rely on - The root pattern is reusable: registering a document-level hotkey in a parent's
onMountedwhile children paint first will reproduce this anywhere. Worth a note in the design-system contract if the fix is a convention rather than a one-off. - Related: trinity-enterprise#261
Activity
fix(dashboard): arm the / hotkey at mount, not behind five fetches (#…
fix(perf): Agent Detail + Workspace stop over-fetching — dedupe, batc…
fix(dashboard): pin the view-mode switcher and add a v shortcut to cy…