Repository navigation
Add hover previews for node references (#34) - #2024
Merged
Merged
Conversation
Node references — both the markdown-link form rendered by view-mode-renderer and the bare `[[id]]` wikilink form (NodeRefInline) — now show a preview card on hover or keyboard focus with the target node's title and a content snippet. Both render paths resolve to the same `a.ns-noderef` anchor, so a single document-level trigger in app-shell drives them all, mirroring the existing delegated click handler. A shared controller owns the reveal delay and cache-first resolution (SharedNodeStore); the card renders itself with viewport-aware positioning and is pointer-events:none so it never traps the cursor. Dismissed on mouse-out, blur, Escape, or scroll. Deleted (broken) references are skipped. The node-id parsing previously inlined in app-shell's click handler is extracted to `extractNodeIdFromHref` and reused by both the click and preview paths. Co-Authored-By: Claude <[email protected]>
Crossing nested spans inside a reference re-fires requestPreview; guard on the pending id alone so the delay keeps counting from the first hover instead of restarting each time (which could keep the card from ever appearing). Co-Authored-By: Claude <[email protected]>
- Re-measure the card position after content resolves (loading → title+snippet). The positioning effect now depends on the resolved-content fields, so the flip-above/clamp decision uses the final card height instead of the shorter loading card — a tall card near the viewport bottom no longer overflows. - Link the active reference anchor to the card via aria-describedby while shown, so keyboard/screen-reader users get the same title+snippet on focus. - Scope focusout dismissal to reference anchors, so a hover-shown card isn't torn down by an unrelated element losing focus. - Track the pending anchor alongside the pending id, so the same node referenced by two anchors re-anchors instead of keeping the stale one. Co-Authored-By: Claude <[email protected]>
Contributor
Author
|
APPROVE (self-review, mstomar125) Two-pass adversarial review. First pass flagged a real MAJOR positioning bug — the card measured its loading size and never re-measured after content resolved, so a reference near the viewport bottom got a clipped card — plus three minors (a11y association, unscoped focusout, stale anchor for a repeated node id). All four addressed in
Second pass verified all four fixes correct with no new defects. Gate green on each push; full suite 195 files / 4500 tests, lint + svelte-check clean. |
21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds hover/focus preview cards for node references — the last remaining gap on #34 (everything else in the original spec was already built; see the re-scope comment on the issue).
Both reference render paths converge on the same
<a class="ns-noderef" href="nodespace://…">anchor:view-mode-renderer.svelte, and[[id]]wikilink form (NodeRefInline).So a single document-level trigger in
app-shelldrives previews for all of them, mirroring the existing delegatedhandleLinkClickhandler.Behavior
Escape, or scroll.SharedNodeStore(getNode→ensureNode); a card shows a loading then not-found state if the node can't be resolved.pointer-events: none, so it never traps the cursor — the reference beneath it owns show/hide entirely.Design notes
node-ref-preview.svelte.tsowns timing + resolved content; the card component (references/node-ref-preview.svelte) owns only presentation/positioning. One shared instance is rendered near the root ofapp-shell.handleLinkClickis extracted toextractNodeIdFromHrefinexternal-links.tsand reused by both the click and preview paths.#taskmachinery from the original 2025 spec was intentionally dropped — the real reference model is rendered markdown links, and the data layer already exists (per the issue's re-scope).Tests
node-ref-preview.test.ts— title/snippet builders + the show/hide state machine (delay, cache-first vs fetch, not-found, async-race guard, and the no-reset-on-repeat-hover guard). Usesvi.spyOnon the realsharedNodeStoresingleton (novi.mock, so nothing leaks under the forks pool).external-links.test.ts— extended withextractNodeIdFromHrefcases (standard/node//query-param/empty/non-nodespace).svelte-checkclean.Closes #34.
🤖 Generated with Claude Code