Repository navigation
fix(prompt): drop Peek when a prompt opens over another plugin's modal - #2239
Conversation
A run started while another plugin's dialog is open, such as Full Calendar Remastered's event editor, opens its prompt on top of that dialog. Peek then hid the prompt, showed the dialog instead of the note, moved focus to the editor behind the dialog's backdrop, and parked the run behind a "QuickAdd is waiting" chip. A CSS rule hides the Peek button while a non-QuickAdd modal container is in the document, and peek() checks the same containers so the Ctrl/Cmd+Shift+E shortcut does nothing there. The rule is live, so a command palette still animating closed on a phone hides Peek only until it detaches. Fixes #2234
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Deploying quickadd with
|
| Latest commit: |
7ad7121
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e274d8df.quickadd.pages.dev |
| Branch Preview URL: | https://issue-2234.quickadd.pages.dev |
|
Independent verification: PASS
Setup: Obsidian 1.13.7 on Linux, isolated e2e vault on a private Xvfb, Full Calendar Remastered 0.13.6 release build with a local calendar. Two capture choices write to the active note at the cursor: a text prompt with
Extra checks on head, all as expected:
The screenshots look right. Over FCR, head shows only Cancel/Ok (or Cancel/Submit), right-aligned, with no gap where Peek was. Notes, none blocking:
|
Fixes #2234. Related to #2235 and #2238.
Summary
When a QuickAdd run starts while another dialog is open, such as Full Calendar Remastered's New Event editor, the QuickAdd prompt opens on top of that dialog. Before this change, the prompt still offered Peek at note and
Ctrl/Cmd+Shift+E. Peeking there:The prompt now omits Peek while another modal is open in the same window. The shortcut does nothing there. Over a plain note, Peek works as before.
How it works
src/styles.csshides.qa-peek-buttonwhilebodyhas a direct.modal-containerchild without.quickAddModal.InputPromptPeek.peek()returns early on the same condition. This covers the shortcut on the text prompt and on the one-page form.The rule is evaluated live, not once when the prompt opens. On phones, Obsidian runs a command palette pick while the palette is still animating closed, and its container is still in the DOM. A one-time check at open hid Peek on every palette run on a phone. With the live rule, Peek is hidden for about 250 ms and appears once the palette detaches. The Cancel and Ok buttons do not move.
Why keep Peek and only hide it here
Peek is intentional. It shipped in 2.23.0 (#1688) so a user can read or select text in the note without losing a draft. The reporter may have upgraded from a release before 2.23.0, which explains "it used to work". Peek's design assumes the prompt sits over the workspace, and
supportsPeek()already withholds it from settings and builder prompts for that reason. Over a third-party dialog, the note is behind a modal backdrop, so Peek cannot show it, and Insert selection reads the editor selection the user cannot make. Hiding Peek there removes a trap and costs nothing a user could use. Removing Peek everywhere would drop a working feature for the common case to fix a rare one.Reproduction
Obsidian 1.13.7, Full Calendar Remastered 0.13.6, a capture choice with format
Person: {{VALUE:Name}}that captures to the active file:Ctrl/Cmd+Shift+E.Before: the prompt is hidden, focus moves to
.cm-contentoutside every modal, and the chip overlaps the New Event dialog. After: the prompt has no Peek button, the shortcut does nothing, and submitting captures to the note and returns focus to Event Title.QuickAdd hotkeys and the command palette cannot fire while Full Calendar's dialog is open, because Obsidian gives a modal's keymap scope no parent (checked in both 1.13.7 and 1.14.4). A real user reaches this state with a command run that bypasses hotkeys, or by starting QuickAdd first.
Not covered here
Ctrl/Cmd+Shift+E, holding it past key autorepeat (660 ms on the test display) peeks the new prompt at once. This PR does not change that.Ctrl/Cmd+Shift+Ecannot return, because the dialog's scope is above the peek's return scope. The chip's Return button still works. On Android, after Return, Back closes the other dialog under the prompt.Verification
tests/e2e/peek-over-plugin-modal.test.ts: 2 passed on this branch. Against the unfixed source, it fails withpeekVisible: trueover the other modal..agents/run-e2e): 452 passed, 24 skipped.pnpm run testandpnpm run lintpass. The two new unit tests fail without the fix (expected true to be falseonisPeeking()).Release impact
User-visible behavior change limited to prompts opened over another modal. No settings or migrations. The docs page Controlling prompts now says when Peek does not appear.
Note
Make
InputPromptPeek.peeka no-op when a prompt opens over another plugin's modalInputPromptPeek.peekwhen the prompt container sits over another modal container, checked by the newisOverAnotherModalutility in InputPromptPeek.tsisOverAnotherModaltreats any direct modal container child of the document body (excluding QuickAdd's own) as an overlay; a plugin using a non-standard container structure could still allow PeekMacroscope summarized 7ad7121.
Summary by CodeRabbit