fix(mobile): keep QuickAdd dialogs above the on-screen keyboard - #2133
Conversation
On a phone the keyboard covered the lower part of QuickAdd dialogs: the date prompt's Ok, the multi-select's Cancel and Done, and in the macro builder the field being typed in, under the pinned footer. A dialog now sits in the space above the keyboard, a prompt's buttons stay in view when it scrolls, and the focused field is scrolled back into view once the keyboard is up. With the keyboard down nothing moves. Fixes #2132
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 (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughPhone QuickAdd modals adjust their layout when the on-screen keyboard is open. A keyboard event also scrolls the focused field into view when it is inside a QuickAdd modal. ChangesPhone keyboard visibility
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The phone keyboard changes have no confirmed merge-blocking issue. Desktop dialog sizing remains unverified. 🚥 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 taps the keys below, Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a68896a57e
ℹ️ 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".
…yboard On a phone in landscape the viewport is wider than 540px, so the multi-select kept its own 80vh cap and could still reach under the keyboard. It now also respects --dialog-max-height, which is 85vh on desktop and leaves out the keyboard on a phone.
Summary
On a phone the on-screen keyboard covered the lower part of QuickAdd dialogs (#2132): the date prompt's Ok, the multi-select's Cancel and Done, and in the macro builder the field being typed in, under the pinned footer. Obsidian keeps a modal centered on the whole screen and lays the keyboard over it.
.is-phone .modal-container.quickAddModalends at the keyboard (bottom: var(--keyboard-height)) and redefines--dialog-max-heightwith core's phone formula minus the keyboard, so a dialog sits in the space above it. A top padding ofmin(--keyboard-height, top inset)keeps it under the status bar only while the keyboard is up.--safe-area-inset-bottomwhile the keyboard is up.<input>is not the field. Once the keyboard is up (keyboardDidShow), QuickAdd scrolls the focused field in a QuickAdd dialog back into view.With the keyboard down every dialog and button is where it was: measured on the phone, the modal and button rects of the text prompt, date prompt, multi-select and one-page form are identical to dd59057.
An earlier try that padded each dialog by the keyboard height also kept the buttons visible, but the dialog then stretched down to the keyboard and the tall date prompt scrolled its input out of view, so it was dropped.
Before / after (iPhone, iOS 18.7, Obsidian 1.14.3)
(The "after" screenshots are from the same CSS and listener injected into the 2.30 candidate on the phone; the built PR was then deployed to the phone and measured with the real keyboard: date input 150-194 and Ok 559-595, multi-select Done 501-545, one-page last field 496-540 above Submit, macro script field 491-535 with the footer starting at 535, keyboard top at 611.)
Testing
tests/e2e/phone-keyboard.test.ts(desktop Obsidian, phone classes,--keyboard-height: 345px): the date prompt's field and Ok, the multi-select's Done, and the macro builder's script field afterkeyboardDidShoware above the keyboard. All three fail on master; with only the CSS (no listener) the macro test fails on its last assertion.pnpm run test: 6607 passed, 33 skipped.pnpm run build-with-lint: clean.Release impact
Phone only. No settings or data change. The issue is older than 2.30 (2.29.0 behaves the same).
Fixes #2132
Summary by CodeRabbit
Note
Fix QuickAdd mobile dialogs being hidden by the on-screen keyboard
Keeps QuickAdd modal inputs and action buttons visible when the mobile keyboard opens.
keepFocusedFieldInView, which listens for the keyboard-shown event and scrolls the focused field inside a QuickAdd modal into view; wired up in main.ts during plugin load.--keyboard-heightcustom property; modals reposition above the keyboard instead of sitting under it.Macroscope summarized 678494a.