Skip to content

feat(ui): CoachTip coaching tooltip component (RIG-2703) - #615

Open
rigel-mintaka wants to merge 1 commit into
compass-ux/rig-2707-chord-grammar-helpersfrom
compass-ux/rig-2703-coachtip-component
Open

feat(ui): CoachTip coaching tooltip component (RIG-2703)#615
rigel-mintaka wants to merge 1 commit into
compass-ux/rig-2707-chord-grammar-helpersfrom
compass-ux/rig-2703-coachtip-component

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 4 PRs:

  1. main
  2. feat(keyboard): sequence-grammar chord helpers for leader chords (RIG-2707) #612
  3. "feat(ui): CoachTip coaching tooltip component (RIG-2703)" (this PR)
  4. feat(ui): adopt CoachTip across command-backed chrome + register sidebar toggles (RIG-2704) #618
  5. docs(ui): document the shipped CoachTip consumer + retarget the ShortcutChip note (RIG-2705) #620

Adds the reusable coaching Tooltip from the frozen coaching-tooltips design (docs/designs/product/compass-coaching-tooltips/design.md, T1 / §A1-A3, A5, D5): a label + keymap-resolved chord that reveals on hover AND focus, in the shipped .cx-tooltip box. This is the component only; the adoption sweep across command-backed chrome is T2 (RIG-2704).

  • apps/ui/src/components/CoachTip.tsx — three exports mirroring Kobalte's own anatomy: COACH_TIP_DELAY_MS = 400 (mirrors the --cx-tooltip-delay token, tokens.css:227); CoachTip, the Kobalte v2-alpha Tooltip root with openDelay defaulted to that constant and hover+focus reveal (Kobalte's default, triggerOnFocusOnly unset); CoachTipTrigger, the re-exported polymorphic Tooltip.Trigger so call sites author their own element; and CoachTipContent, the Tooltip.Portal + Tooltip.Content(class="cx-tooltip") rendering the label and, right of it, the chord.
  • Chord is always the keymap-resolved display string — props.chord ?? shortcutFor(props.command, detectPlatform()), never hand-authored (DL-234's single-derivation rule). undefined → label-only; a " then " leader sequence → plain text in the chip's typographic style; any other chord → <ShortcutChip>. Because the component only reads shortcutFor's output, it shows Ctrl+B/Cmd+B today and G then B automatically once the leader-chord rows land — no merge-order dependency. Props are never destructured (Solid v2 reactivity).
  • apps/ui/src/design/components/tooltip.css — the box (.cx-tooltip, whose first consumer this is) becomes a flex row and gains a .cx-tooltip-label sub-part, so the label takes free space and the reused .cx-palette-shortcut chord chip right-aligns via its own margin-left: auto.

Tests (CoachTip.test.tsx, @solidjs/testing-library): label + chord derived from shortcutFor (never a hand-authored expectation); the ARIA wiring Kobalte owns (role="tooltip" + aria-describedby); focus reveal with no pointer event; the label-only path for a command with no keymap row; and the sequence-aware branch, whose "G then B" fixture is derived from formatChordForDisplay("G B", "other") so a change to the shared format contract surfaces here as a failing test rather than a giant <kbd>.

Stacked on RIG-2707 (the formatChordForDisplay sequence-grammar root the sequence branch keys off).

Ledger-impact: none. DL-245..247 for this record landed with the design PR (#569); this impl slice ratifies no new decision.

Refs RIG-2703

Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Aug 25, 2026

Copy link
Copy Markdown

RIG-2703

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-ux-rig-2703-coachtip.compass-eng-docs.pages.dev

Deployed from compass-ux/rig-2703-coachtip-component at f28db7f.

@rigel-mintaka
rigel-mintaka force-pushed the compass-ux/rig-2707-chord-grammar-helpers branch from 09f111f to 6a8939e Compare August 25, 2026 17:51
@rigel-mintaka
rigel-mintaka force-pushed the compass-ux/rig-2703-coachtip-component branch from 3a3c493 to 5ef0631 Compare August 25, 2026 17:52
Adds the reusable coaching Tooltip from the frozen coaching-tooltips design (`docs/designs/product/compass-coaching-tooltips/design.md`, T1 / §A1-A3, A5, D5): a label + keymap-resolved chord that reveals on hover AND focus, in the shipped `.cx-tooltip` box. This is the component only; the adoption sweep across command-backed chrome is T2 (RIG-2704).

- `apps/ui/src/components/CoachTip.tsx` — three exports mirroring Kobalte's own anatomy: `COACH_TIP_DELAY_MS = 400` (mirrors the `--cx-tooltip-delay` token, `tokens.css:227`); `CoachTip`, the Kobalte v2-alpha `Tooltip` root with `openDelay` defaulted to that constant and hover+focus reveal (Kobalte's default, `triggerOnFocusOnly` unset); `CoachTipTrigger`, the re-exported polymorphic `Tooltip.Trigger` so call sites author their own element; and `CoachTipContent`, the `Tooltip.Portal` + `Tooltip.Content(class="cx-tooltip")` rendering the label and, right of it, the chord.
- Chord is always the keymap-resolved display string — `props.chord ?? shortcutFor(props.command, detectPlatform())`, never hand-authored (DL-234's single-derivation rule). `undefined` → label-only; a `" then "` leader sequence → plain text in the chip's typographic style; any other chord → `<ShortcutChip>`. Because the component only reads `shortcutFor`'s output, it shows `Ctrl+B`/`Cmd+B` today and `G then B` automatically once the leader-chord rows land — no merge-order dependency. Props are never destructured (Solid v2 reactivity).
- `apps/ui/src/design/components/tooltip.css` — the box (`.cx-tooltip`, whose first consumer this is) becomes a flex row and gains a `.cx-tooltip-label` sub-part, so the label takes free space and the reused `.cx-palette-shortcut` chord chip right-aligns via its own `margin-left: auto`.

Tests (`CoachTip.test.tsx`, `@solidjs/testing-library`): label + chord derived from `shortcutFor` (never a hand-authored expectation); the ARIA wiring Kobalte owns (`role="tooltip"` + `aria-describedby`); focus reveal with no pointer event; the label-only path for a command with no keymap row; and the sequence-aware branch, whose `"G then B"` fixture is derived from `formatChordForDisplay("G B", "other")` so a change to the shared format contract surfaces here as a failing test rather than a giant `<kbd>`.

Stacked on RIG-2707 (the `formatChordForDisplay` sequence-grammar root the sequence branch keys off).

Ledger-impact: none. DL-245..247 for this record landed with the design PR (#569); this impl slice ratifies no new decision.

Refs RIG-2703

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant