fix(one-page): open the form in the first field without a picked note - #2115
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughOnePageInputModal 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. ChangesOne-page capture focus
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to 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)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. A rabbit opens forms at dawn Comment |
There was a problem hiding this comment.
💡 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".
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
dd8649f to
bbe5189
Compare
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.
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 innote.How
Obsidian's
Modal.open()runsonOpen()and then, with a physical keyboard, focuses the modal's first focusable element.OnePageInputModalnow overridesopen(): 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 innote, 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