diff --git a/frontend/src/components/StateCard.ts b/frontend/src/components/StateCard.ts index 27bc6e94..90fdfff9 100644 --- a/frontend/src/components/StateCard.ts +++ b/frontend/src/components/StateCard.ts @@ -9,6 +9,12 @@ import type { StateView } from '../api/types.js'; @customElement('hc-state-card') export class StateCard extends LitElement { + // `delegatesFocus` lets Tab key traversal from the light DOM reach the + // role="button" element inside this card's shadow root. Without it the + // user can only activate the card via mouse click or by JS-focusing the + // inner div; with it, the natural tab sequence flows through every card. + static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true }; + @property({ type: Object }) state!: StateView; /** Optional: icon SVG string (use `iconSvg()` from lucide.ts) */ @property({ type: String }) iconSvg?: string; @@ -32,6 +38,9 @@ export class StateCard extends LitElement { border-color: hsl(185 80% 50% / 0.4); } + .card { cursor: pointer; } + .card:focus-visible { outline: 2px solid var(--hc-primary, #19d4e5); outline-offset: 2px; } + .header { display: flex; align-items: flex-start; @@ -108,7 +117,10 @@ export class StateCard extends LitElement { const badge = this.badgeClass(state); return html` -