Skip to content

fix(draft-card): Phase 5 followups — buttons fit, sr-only, copy, locale, iframe shortcut#32

Merged
AlexandreCamillo merged 1 commit into
mainfrom
fix/draft-card-phase5-followups
May 23, 2026
Merged

fix(draft-card): Phase 5 followups — buttons fit, sr-only, copy, locale, iframe shortcut#32
AlexandreCamillo merged 1 commit into
mainfrom
fix/draft-card-phase5-followups

Conversation

@AlexandreCamillo
Copy link
Copy Markdown
Owner

Summary

Five fixes surfaced by visual+behavior QA of #31 against prod. Quick wins; no API surface changes.

Bug Fix
B1 N shortcut didn't fire when iframe was focused useDraftKeyboard accepts an optional iframeRef; bridges keydown from iframe.contentDocument to the parent's handler (same-origin only, try/catch guarded). AppMainViewer threads its iframeRef through.
B2 Action row buttons overflowed the 300 px rail — Cancel was clipped off-screen Tighter Kbd chips inside DraftCard buttons via a new .kbdInBtn className passed to <Kbd> (min-width 14, font 9.5 px, padding 1 4); actions row gap 8 → 6 px. Recovers ~30 px. Sibling Kbd consumers (annotations-rail add button, command palette) are untouched.
B3 Form.Label className="sr-only" rendered as visible "Annotation body" text Added the canonical visually-hidden recipe to src/app/globals.css.
M1 AlertDialog body said "You'll lose 0 pins and the text you typed" Branched the description over (bodyLen, pinCount) — drops the "lose 0 pins" awkwardness.
M2 Char counter rendered 10.000 (pt-BR) instead of DS-spec 10 000 Replaced toLocaleString() with a fixed thousands-separator regex.

Test plan

  • pnpm tsc --noEmit clean
  • pnpm biome check src/components/DraftCard src/hooks/useDraftKeyboard.ts src/components/MockupViewer/AppMainViewer.tsx src/app/globals.css — clean
  • DraftCard + useDraftKeyboard + draft-annotation-flow tests: 16/16 passing
  • Post-deploy: re-verify on prod — N fires inside iframe, Cancel visible, Annotation body label hidden, AlertDialog copy clean, counter shows 10 000

Related

…le, iframe shortcut

Surfaced by visual+behavior QA against prod (docs/qa/2026-05-23-draft-annotation-phase5.md).

B1 — N keyboard shortcut now fires when iframe is focused.
useDraftKeyboard accepts an optional iframeRef; when present, the same
keydown handler attaches to iframe.contentDocument (same-origin only,
guarded with try/catch). Re-attaches on iframe `load` so it follows
version-switches. AppMainViewer threads its iframeRef through.

B2 — Action-row buttons fit inside the 300 px rail.
Drop the 8 px gap to 6 px; pass `className={styles.kbdInBtn}` to the
two Kbds inside the Draft + Send buttons. The new `.kbdInBtn` rule in
DraftCard.module.css targets the rendered <kbd> element (higher
specificity than the Kbd module's `.key`) to compress min-width 20→14 px,
font-size 10.5→9.5 px, padding 2px 6px→1px 4px. Recovers ~30 px; Cancel
is no longer clipped. Sibling Kbd consumers (annotations-rail add button,
command palette) are untouched.

B3 — `.sr-only` class now ships globally.
Added the canonical visually-hidden recipe to src/app/globals.css so
`<Form.Label className="sr-only">Annotation body</Form.Label>` stops
rendering as visible text above the textarea.

M1 — AlertDialog body copy branches over (bodyLen, pinCount).
"You'll lose 0 pins and the text you typed" → "You'll lose the text you
typed." (and similar branches for pins-only, both, neither). Discard is
disabled on the empty branch in practice, but the copy handles all four
combinations defensively.

M2 — Char counter no longer drifts by browser locale.
Replaced toLocaleString() (which renders `10.000` in pt-BR, `10,000` in
en-US) with a fixed thousands-separator regex matching the DS-32 contract
(`10 000` with a thin space).
@AlexandreCamillo AlexandreCamillo merged commit b5dcbbb into main May 23, 2026
1 check passed
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