[PR #6577] [MERGED] fix(ui): prevent modal backdrop dismiss when text selection drag ends… #7233

Closed
opened 2026-10-23 04:17:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6577
Author: @menemorofaan
Created: 9/23/2026
Status: ✅ Merged
Merged: 9/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/backdrop-drag-dismiss


📝 Commits (9)

  • d8d143c fix(ui): prevent modal backdrop dismiss when text selection drag ends outside
  • b0737bf Merge branch 'staging' into fix/backdrop-drag-dismiss
  • 3a1c29c fix(ui): require pointer-up on backdrop before dismissal in useBackdropDismiss
  • 439b0be style(ui): format use-backdrop-dismiss with prettier
  • 7818a3f Merge branch 'staging' into fix/backdrop-drag-dismiss
  • bbcde9a fix(ui): hit-test release coordinates against backdrop surface in useBackdropDismiss
  • ac9a16a fix(ui): treat missing hit target as off-backdrop in useBackdropDismiss
  • 8343234 Merge branch 'staging' into fix/backdrop-drag-dismiss
  • 590371e Merge branch 'staging' into fix/backdrop-drag-dismiss

📊 Changes

8 files changed (+49 additions, -18 deletions)

View changed files

📝 packages/client/src/components/chat/ChatImageLightbox.tsx (+5 -6)
📝 packages/client/src/components/chat/ConversationMessageShared.tsx (+3 -1)
📝 packages/client/src/components/chat/EncounterModal.tsx (+5 -2)
📝 packages/client/src/components/chat/MariPromptPreviewModal.tsx (+3 -1)
📝 packages/client/src/components/chat/PeekPromptModal.tsx (+3 -1)
📝 packages/client/src/components/chat/SummariesEditorModal.tsx (+3 -1)
📝 packages/client/src/components/game/GameCharacterSheet.tsx (+3 -1)
📝 packages/client/src/hooks/use-backdrop-dismiss.ts (+24 -5)

📄 Description

Linked issue

Closes #6576

Why this change

Mouse interactions initiated inside modal windows (such as selecting text, clicking near borders, or mouse slips across controls) trigger accidental dialog dismissal if the mouse button is released outside over the backdrop. This interrupts workflow and causes loss of uncommitted edits or viewing context.

What changed

Integrated the existing useBackdropDismiss hook across affected modal, sheet, and lightbox containers. This ensures that backdrop dismissal only triggers when both mousedown and mouseup occur directly on the backdrop itself, safely ignoring drag-releases that originated inside the dialog.

Affected components:

  • GameCharacterSheet
  • ChatImageLightbox
  • ConversationMessageShared (ConversationMessageLightbox)
  • SummariesEditorModal
  • EncounterModal
  • MariPromptPreviewModal
  • PeekPromptModal

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  1. Opened GameCharacterSheet, initiated text selection drag inside the content, and released the cursor outside the dialog boundaries over the backdrop. Verified the sheet remains open and active.
  2. Verified intentional clicks directly on the backdrop still dismiss the sheet as expected.
  3. Tested the same drag-selection behavior across prompt preview modals (PeekPromptModal, MariPromptPreviewModal), encounter modal, summaries editor, and image lightboxes.
  4. Confirmed single backdrop clicks consistently dismiss all modals cleanly.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

N/A (interaction behavior fix)

Summary by CodeRabbit

  • Usability
    • Updated image, video, and modal overlays across chat and game screens to close only when a pointer interaction starts, ends, and clicks on the backdrop. This helps prevent accidental dismissals when interacting with overlay content; canceled pointer interactions do not close overlays.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6577 **Author:** [@menemorofaan](https://github.com/menemorofaan) **Created:** 9/23/2026 **Status:** ✅ Merged **Merged:** 9/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/backdrop-drag-dismiss` --- ### 📝 Commits (9) - [`d8d143c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d8d143c3e423524916cffdfd7df585a95045580a) fix(ui): prevent modal backdrop dismiss when text selection drag ends outside - [`b0737bf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b0737bfafac7ecccd61446716fabe5d914c88408) Merge branch 'staging' into fix/backdrop-drag-dismiss - [`3a1c29c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3a1c29c117de49402b2ddb9dbe437ad40014e469) fix(ui): require pointer-up on backdrop before dismissal in useBackdropDismiss - [`439b0be`](https://github.com/Pasta-Devs/Marinara-Engine/commit/439b0be6ebb835db184c3a048fff7cce5cd873de) style(ui): format use-backdrop-dismiss with prettier - [`7818a3f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7818a3ff9022edb8f1809e68fa2989546b1eaf7c) Merge branch 'staging' into fix/backdrop-drag-dismiss - [`bbcde9a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bbcde9a21012cc58326a31c722eb04addcfbba0a) fix(ui): hit-test release coordinates against backdrop surface in useBackdropDismiss - [`ac9a16a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ac9a16aa1fa002b346ca5824f24e49a97a411a50) fix(ui): treat missing hit target as off-backdrop in useBackdropDismiss - [`8343234`](https://github.com/Pasta-Devs/Marinara-Engine/commit/834323436f2139d09b34ad3bf281038f76d54510) Merge branch 'staging' into fix/backdrop-drag-dismiss - [`590371e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/590371ed8a14c40dde661e97090c0e1fcf939b6c) Merge branch 'staging' into fix/backdrop-drag-dismiss ### 📊 Changes **8 files changed** (+49 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatImageLightbox.tsx` (+5 -6) 📝 `packages/client/src/components/chat/ConversationMessageShared.tsx` (+3 -1) 📝 `packages/client/src/components/chat/EncounterModal.tsx` (+5 -2) 📝 `packages/client/src/components/chat/MariPromptPreviewModal.tsx` (+3 -1) 📝 `packages/client/src/components/chat/PeekPromptModal.tsx` (+3 -1) 📝 `packages/client/src/components/chat/SummariesEditorModal.tsx` (+3 -1) 📝 `packages/client/src/components/game/GameCharacterSheet.tsx` (+3 -1) 📝 `packages/client/src/hooks/use-backdrop-dismiss.ts` (+24 -5) </details> ### 📄 Description ## Linked issue Closes #6576 ## Why this change Mouse interactions initiated inside modal windows (such as selecting text, clicking near borders, or mouse slips across controls) trigger accidental dialog dismissal if the mouse button is released outside over the backdrop. This interrupts workflow and causes loss of uncommitted edits or viewing context. ## What changed Integrated the existing `useBackdropDismiss` hook across affected modal, sheet, and lightbox containers. This ensures that backdrop dismissal only triggers when both `mousedown` and `mouseup` occur directly on the backdrop itself, safely ignoring drag-releases that originated inside the dialog. Affected components: - `GameCharacterSheet` - `ChatImageLightbox` - `ConversationMessageShared` (`ConversationMessageLightbox`) - `SummariesEditorModal` - `EncounterModal` - `MariPromptPreviewModal` - `PeekPromptModal` ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes 1. Opened `GameCharacterSheet`, initiated text selection drag inside the content, and released the cursor outside the dialog boundaries over the backdrop. Verified the sheet remains open and active. 2. Verified intentional clicks directly on the backdrop still dismiss the sheet as expected. 3. Tested the same drag-selection behavior across prompt preview modals (`PeekPromptModal`, `MariPromptPreviewModal`), encounter modal, summaries editor, and image lightboxes. 4. Confirmed single backdrop clicks consistently dismiss all modals cleanly. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) N/A (interaction behavior fix) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Usability** * Updated image, video, and modal overlays across chat and game screens to close only when a pointer interaction starts, ends, and clicks on the backdrop. This helps prevent accidental dismissals when interacting with overlay content; canceled pointer interactions do not close overlays. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:17:46 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7233
No description provided.