Skip to content

fix: preserve folder path suggester clicks#1211

Merged
chhoumann merged 1 commit into
masterfrom
fix/1210-folder-path-selection
May 23, 2026
Merged

fix: preserve folder path suggester clicks#1211
chhoumann merged 1 commit into
masterfrom
fix/1210-folder-path-selection

Conversation

@chhoumann
Copy link
Copy Markdown
Owner

@chhoumann chhoumann commented May 23, 2026

Prevent suggestion popups from closing on mousedown before their click handler can select an item. This restores the folder-path picker in template settings on Obsidian 1.12.x, where clicking a folder suggestion blurred the input and left the typed query in place.

The fix keeps focus while mousing down inside the suggester popup, matching the pre-2.12.1 behavior. I added a regression test for the mousedown/blur/click ordering that previously dropped the selection.

Validation:

  • Reproduced in the dev vault before the fix: CDP click on Adventure left the folder path input as Adv, focused BODY, and the folder list stayed empty.
  • bun run test
  • bun run build-with-lint
  • Reloaded QuickAdd in the dev vault and reran the same CDP path: clicking Adventure changed the input to Adventure; clicking Add rendered Adventure in the folder list; obsidian vault=dev dev:errors reported no captured errors.

Fixes #1210

Summary by CodeRabbit

  • Tests

    • Added test suite for text suggestion functionality.
  • Bug Fixes

    • Improved suggestion selection behavior to prevent unintended input focus loss during interaction.

Review Change Stack

@chhoumann chhoumann linked an issue May 23, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 15780e3d-2ddc-48c2-b5f3-1763b8d567e2

📥 Commits

Reviewing files that changed from the base of the PR and between 7563783 and 150993c.

📒 Files selected for processing (2)
  • src/gui/suggesters/suggest.test.ts
  • src/gui/suggesters/suggest.ts

📝 Walkthrough

Walkthrough

This PR fixes folder path suggestion selection by unconditionally preventing default mousedown behavior in the suggestion dropdown, preventing the input from losing focus before click selection registers. A new test validates the complete interaction flow.

Changes

Suggestion Selection

Layer / File(s) Summary
Prevent mousedown default and validate selection flow
src/gui/suggesters/suggest.ts, src/gui/suggesters/suggest.test.ts
suggestEl mousedown handler now unconditionally calls event.preventDefault() for any mousedown within the container. New Vitest test mocks the Obsidian App, mounts an input, triggers typing to render a suggestion, verifies mousedown prevents default to maintain focus, and confirms click selection updates the input value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

released

Poem

A suggestion falls, yet click won't land,
Focus slips through the mousedown command,
One preventDefault to hold the line,
A test now proves selection's working fine! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: preserve folder path suggester clicks' directly and concisely describes the main change: preventing suggester popups from closing prematurely when mousedown occurs before click handling.
Linked Issues check ✅ Passed The code changes directly address issue #1210: preventing blur on mousedown in the suggester and adding a regression test to verify folder selection works by preventing default behavior during mousedown before click selection.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the folder path suggester selection issue—modifying mousedown event handling in suggest.ts and adding a test suite in suggest.test.ts; no unrelated code changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1210-folder-path-selection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: 150993c
Status: ✅  Deploy successful!
Preview URL: https://4ffa60a1.quickadd.pages.dev
Branch Preview URL: https://fix-1210-folder-path-selecti.quickadd.pages.dev

View logs

@chhoumann chhoumann marked this pull request as ready for review May 23, 2026 20:51
@chhoumann chhoumann merged commit 12af015 into master May 23, 2026
4 checks passed
@chhoumann chhoumann deleted the fix/1210-folder-path-selection branch May 23, 2026 21:45
github-actions Bot pushed a commit that referenced this pull request May 23, 2026
## [2.12.2](2.12.1...2.12.2) (2026-05-23)

### Bug Fixes

* clean up scorecard style warnings ([7563783](7563783))
* preserve suggester selection clicks ([#1211](#1211)) ([12af015](12af015))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.12.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link
Copy Markdown

🚀 Release has been published: v2.12.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Unable to select folder path to create note in

1 participant