Kjell Tore Guttormsen
a7a6a53686
feat(voyage): add three annotation creation gestures + form modal — v4.2 Step 9 [skip-docs]
Three creation gestures + shared form modal for the v4.2 annotation
playground (per critical decisions #2-#4 + research-06):
Gesture 1 — text-anchored adder-popup:
- mouseup-debounce 200ms (settles selection)
- 300ms grace before hide (Hypothes.is friction-mitigation)
- floating .voyage-adder-popup positioned at selection-bound corner
- click -> opens form modal with derived heading-path + line + snippet
Gesture 2 — paragraph-anchored hover-icon:
- 24px pencil SVG injected per <p>/<li> after each render
- opacity 0 default, opacity 1 on hover/focus-visible
- click -> opens form modal with no snippet
Gesture 3 — page-level note:
- .voyage-page-note-btn injected in viewport
- click -> opens form modal with target=page
Form modal (shared):
- role="dialog" aria-modal="true" + aria-labelledby
- 400px right-anchored on backdrop (per critical decision #3)
- 4 intent buttons (Fiks / Endre / Spørsmål / Block) as aria-pressed group
- <textarea> required for comment
- ESC + backdrop-click + Avbryt close
- Lagre persists via saveModalAsAnnotation
Anchor-ID generation (per critical decision #2 + risk-assessor H7):
- sequential ANN-NNNN per project+file scope
- persisted in localStorage under voyage_ann_<project>__<file>.drafts
Test coverage: tests/playground/voyage-playground.test.mjs +3 cases —
aria-modal, ANN-, 300ms grace.
Verify: node --test tests/playground/voyage-playground.test.mjs ->
16 pass / 0 fail.
Full npm test: 590 pass / 0 fail / 2 skipped (Docker).
Refs plan.md Step 9 + critical decisions #2/#3/#4 + research-06.