Skip to content

ENG-2265 Add a preview toggle to advanced node search - #1561

Open
trangdoan982 wants to merge 6 commits into
mainfrom
eng-2265-add-a-preview-toggle-to-advanced-node-search
Open

trangdoan982 wants to merge 6 commits into
mainfrom
eng-2265-add-a-preview-toggle-to-advanced-node-search

Conversation

@trangdoan982

@trangdoan982 trangdoan982 commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Reviewer brief

  • Result: The Advanced Node Search preview is hidden by default, and the result list is full width. Clicking a result focuses the list. While the list has focus, → opens the preview and ← closes it. In the query input, ←/→ only move the caret. The footer shows a matching "→ preview" / "← close preview" button only while the list has focus, so the hint appears only when the keys work.
  • Review focus:
    • Key routing in handleKeyDown (NodeSearchModal.tsx). With the list focused, every key outside RESULT_LIST_KEYS moves focus to the query and is left unprevented, so typing, Backspace and paste land there. Backspace on an empty query is replayed on the query field so the chip input still highlights the last chip.
    • The divider uses border-0 border-r border-solid. apps/obsidian ships no Tailwind preflight, so border-r alone draws nothing. The split view on main had the same invisible divider.
  • Risk or follow-up (known, deliberately left out of this PR):
    • The preview needs a click to reach: the list only takes focus from a click, and the footer toggle is hidden until it does. Keyboard-only users can't open the preview.
    • With the list focused, any key outside the list's own set moves focus to the query. That includes Cmd+C, Cmd+A, CapsLock, Space, PageUp/PageDown and Home/End.
    • A modified arrow on the focused list (Cmd/Alt/Shift + ←/→) also toggles the preview.
    • Rows can be text-selected, because a click now focuses the list instead of being prevented.
    • Focus returns to the query whenever results become empty and nothing has focus, not only when the list itself lost focus.
    • The focused list has no visible focus style or aria-activedescendant.
    • Mobile is untested. The search modal isn't desktop-gated. If Obsidian hides prompt-instructions on mobile, the preview can't be opened there.
    • IME is untested. The first key after clicking a result may not start a composition.

Verification

  • The key routing has no unit tests: the logic lives inside the React component, and apps/obsidian's Vitest runs without a DOM. It is covered by live Obsidian scenarios instead, driven over CDP on 2e717d86. All 13 pass:
Scenario Result
Preview hidden on open List 100% wide, no toggle in footer
Arrows in query move caret only Caret 2→1→2, preview stays closed
Click row then → opens preview List focused, 1px solid divider, list 40% wide, ↓ updates the preview
← in list closes preview List back to 100%, focus stays on list
Typing in list returns to query Focus list→query, query "ab"
Backspace in list edits query Focus list→query, query "u"
Backspace in list highlights last chip Focus list→chip, chip kept
← at query start still focuses chip Chip focused, preview stays closed
Focus recovers when results empty Focus list→query
Footer button toggles preview Toggle appears after clicking a result, opens then closes, focus stays on list
Toggle hides when typing with preview open Preview stays open, focus in query, toggle hidden
Toggle hides when clicking preview text Preview stays open, list loses focus, toggle hidden
Toggle stays hidden on Tab to footer Focus on a footer button, toggle hidden
  • pnpm install --frozen-lockfile && pnpm ci:validate passes: 23/23 Obsidian test files (227 tests), with typecheck and lint clean.

Loom video

https://www.loom.com/edit/309af51172d840e7ac2eae4d98ca1217

Scope check

  • Ran $scope-check against ENG-2265 and the final diff.
  • Scope beyond Done When: The preview opens with → only while the result list has focus, which a click on a result gives it, not "once the cursor is at the end of the query" as the ticket's Solution says. To support that, the result list can take focus, keys it does not use (typing, Backspace, paste) go back to the query, Backspace on an empty query still highlights the last filter chip, the footer toggle shows only while the list has focus, and focus returns to the query if the list disappears while focused. setCaretToEnd moved into src/utils for its second caller.
  • Required now: Requested by the author during implementation so ←/→ in the query input always move the caret; without list focus the → shortcut could never fire, and without the key routing a focused list would swallow edits.

Standards check

  • Ran $dg-pr-adherence-check against the final diff and PR metadata.

Local delegated full review

  • Ran a comprehensive review of the entire final diff in a subagent with a fresh context. Use $dg-delegated-full-review when no other full-review workflow is available.

🤖 Generated with Claude Code


Devin Review

trangdoan982 and others added 6 commits October 17, 2026 13:25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M553MJAJGAZENTTPQS6XNF25
Move shared caret and key helpers into utils, restore focus when the
focused list unmounts, and share one canAct gate between → and the footer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M555GDHXSDER5W65G8H13XB0
Keep isPlainCharacterKey beside its only caller in the chip input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M555VDTK8PCFF5EDKM8R6R9H
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M55E3ZQ8GRR7X8TNBJSRATKS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M55ED9K2G71M0ZSJTY2RHQK8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M55EGXF6KJM9FVEDCJ59MFYW
@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
discourse-graph Skipped Skipped Oct 17, 2026 5:30pm UTC

Request Review

@supabase

supabase Bot commented Oct 17, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@linear-code

linear-code Bot commented Oct 17, 2026

Copy link
Copy Markdown

ENG-2265

Comment on lines +666 to +670
onFocus={(event) =>
setIsResultListFocused(event.target === listRef.current)
}
// Focus can leave to non-focusable modal areas, which fire no focus event here.
onBlur={() => setIsResultListFocused(false)}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the preview toggle only appears while the result list has focus:

  1. In the query input, ←/→ stay caret movement, so the preview shortcut can only work while the result list has focus. Clicking a result gives it focus.
  2. The footer should only advertise a key where that key works. Showing "→ preview" while the user types would point at a key that moves the caret instead.
  3. onFocus records whether the list has focus. onBlur clears it, because clicking somewhere in the modal that can't take focus (for example the preview text) fires no focus event inside this wrapper. Without it, the toggle would stay visible after ←/→ stopped working.

Trade-off: a keyboard-only user can't open the preview, because only a click focuses the list. It's listed under Risk in the PR description.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread apps/obsidian/src/components/NodeSearchModal.tsx

This branch was previously deployed

1 inactive deployment
Preview — 2e717d86 Deployed Oct 17, 2026 by vercel[bot]
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