Skip to content

fix: keep modals open when dragging over backdrop - #6827

Open
sridharkalaibala wants to merge 1 commit into
GrapesJS:devfrom
sridharkalaibala:fix/modal-backdrop-drag
Open

sridharkalaibala wants to merge 1 commit into
GrapesJS:devfrom
sridharkalaibala:fix/modal-backdrop-drag

Conversation

@sridharkalaibala

Copy link
Copy Markdown

Fixes #6683.

A press inside the dialog followed by a release on the backdrop can generate a click targeted at the modal container, closing the editor while the user is dragging or selecting text. Track whether the press or release occurred inside the dialog and ignore the resulting backdrop click. Reset the gesture state after the click so the next complete backdrop click still closes normally.

The reverse gesture (backdrop to dialog) also stays open. The close button and backdrop: false behavior are preserved.

Validation:

  • Added five modal-view tests. The fixture now passes em.Modal to the modal model, matching the production module/configuration; the old fixture passed the whole editor and had no backdrop setting.
  • On the original source, both drag-direction tests fail while normal backdrop and close-button controls pass.
  • Full core suite passes: 1,532 tests and 17 snapshots; 47 existing tests skipped across one skipped suite.
  • CLI build, core JS/ESM/CSS/declaration builds, declaration type check, changed-file ESLint, Prettier, and git diff --check pass.
  • Chromium loaded the locally built editor and CSS, opened a modal with a textarea, and reproduced the original failure using native mouse input. After the fix, drags in both directions stay open; normal backdrop mouse clicks and touch taps respect the backdrop option; the close button closes. Checked with backdrop both true and false, without page errors.

Tested on Windows with Node 24.19 and pnpm 9.10.0. The browser fixture uses the real editor.Modal.open() path; the external custom-code plugin from the issue was not installed. Generated build artifacts and dependencies are excluded.

AI assistance: OpenAI Codex was used for investigation, implementation, and validation.

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.

BUG: Modals close on mouseup event outside of modal rather than a full click

1 participant