Skip to content

fix(one-page): open the form in the first field without a picked note - #2115

Merged
chhoumann merged 2 commits into
masterfrom
fix/2110-one-page-initial-focus
Oct 1, 2026
Merged

chhoumann merged 2 commits into
masterfrom
fix/2110-one-page-initial-focus

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

A one-page form that starts with a file picker holding a note now opens in the first field without a picked note. Before, the keyboard focus was on that note's remove button (×), so typing went nowhere and Enter or Space removed the note. Every one-page capture to a folder, tag or property starts this way: Capture to comes first since #1955 and is a file picker with the first note picked since #2099. In 2.29.0 these forms opened in the capture text field.

Before After
Light before after
Dark before after

Obsidian 1.13.7, a Capture to People/ with format - {{VALUE:note}} and one-page input on, run from its command. Before, focus is on Remove Ada Lovelace; after, it is in note.

How

Obsidian's Modal.open() runs onOpen() and then, with a physical keyboard, focuses the modal's first focusable element. OnePageInputModal now overrides open(): only when that element is a picked note's remove button, it moves focus to the first visible, enabled input, textarea or select outside a file picker that holds a note. With no such field it falls back to the first control. Forms that don't start with a picked note keep Obsidian's focus. Phones are unaffected, since Obsidian doesn't focus anything there.

A form of only file pickers, like {{FILE:}} fields where the last one is empty, now opens in that empty picker, which shows its note list as clicking into it does.

Tests

  • tests/e2e/one-page-capture-target.test.ts: the folder capture's form opens with focus in note, text typed straight away and Mod+Enter land in the note. On master it fails: focus is in Select capture target file (the remove button).
  • pnpm run build-with-lint, pnpm run test (6599 passed), .agents/run-e2e (396 passed, 24 Templater-only skipped).

Release / migration

None.

Fixes #2110

Note

Fix one-page modal focus landing on a picked note's remove button

Overrides the modal open handler in OnePageInputModal.ts. When focus lands on a picked file's remove button, it moves focus to the first visible, enabled form control without a selected-note chip. Falls back to the first available control if no such field exists.

Macroscope summarized bbe5189.

Summary by CodeRabbit

  • Bug Fixes
    • Opening a one-page capture form now focuses an appropriate input field when a file picker would otherwise take focus.
    • Text entered in a folder capture form is saved to the selected note when submitted.

@chhoumann chhoumann linked an issue Oct 1, 2026 that may be closed by this pull request
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T10:53:21.705592Z 60b8281 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 37c2827e-25f0-4360-96e5-02531825a1db

📥 Commits

Reviewing files that changed from the base of the PR and between dd8649f and bbe5189.

📒 Files selected for processing (1)
  • tests/e2e/one-page-capture-target.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

OnePageInputModal corrects initial focus when a file-picker remove button is active. An end-to-end test checks that a folder capture form focuses the note field and writes submitted text to the existing target note.

Changes

One-page capture focus

Layer / File(s) Summary
Initial focus and capture submission
src/preflight/OnePageInputModal.ts, tests/e2e/one-page-capture-target.test.ts
When a file-picker remove button has focus, the modal focuses the first visible, enabled control without a selected-note chip. If none qualifies, it focuses the first visible, enabled control. The test checks note-field focus and verifies that submitted text is written to the existing target note.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to bbe51

The form now focuses the unanswered field instead of the selected note’s remove button, and the added test verifies immediate typing and capture submission. No actionable merge-blocking risk remains after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the coding requirements in #2110. OnePageInputModal.open() detects when Obsidian focuses .qa-onepage-file-picker__remove, then focuses the first visible, enabled input, `text…
Out of Scope Changes check ✅ Passed The changes stay within #2110. The production change corrects one-page form focus. The E2E change verifies the focus regression and the resulting capture. No unrelated production or test changes are s…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: opening the one-page form in the first eligible field when no note is picked.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

A rabbit opens forms at dawn
The note field waits, the chip is still
I tap the keys, the words appear
Then Enter sends them to their note
Soft paws rejoice; the focus holds

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60b8281b93

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/preflight/OnePageInputModal.ts Outdated
Obsidian focuses a modal's first focusable element after onOpen. When the
form starts with a file picker holding a note, such as every one-page Capture
to a folder, tag or property since #1955 and #2099, that was the note's remove
button: typing went nowhere and Enter dropped the note. The form now focuses
the first field without a picked note, usually the capture text, as 2.29.0 did.

Fixes #2110
@chhoumann
chhoumann force-pushed the fix/2110-one-page-initial-focus branch from dd8649f to bbe5189 Compare October 1, 2026 11:58
@chhoumann
chhoumann merged commit 74515a0 into master Oct 1, 2026
12 of 13 checks 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.

One-page form opens with focus on a picked note's remove button

1 participant