🏠 back to Observable

Bug: Dragging outside preview image modal closes modal

Browser: Google Chrome 75.0.3770.100
OS: MS Windows 10.0.17134 Build 17134


  1. Open preview image modal.
  2. Add image (by pasting or dragging, shouldn’t matter).
  3. Zoom in (for visual feedback, though it shouldn’t matter).
  4. Start dragging the preview.
  5. End the dragging outside of the modal.

Expected behavior

Drag ends, modal stays open.

Actual behavior

Modal closes without warning, discarding all changes.


The modal closes when a mouse interaction happens outside of the modal area. Apparently this behavior is bound to mouseup instead of click.
Recommendation: Don’t close modal on outside mouse events. There are already two ways to close the modal (x in the top right and cancel button). Imo discarding the dialog through outside clicks might make sense for notifications, but not for action/option modals.