Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Fixing a 10-year-old fade race in jQuery Modal (#120), and a drag-select bug nobody filed until 2021

说明与用途

jQuery Modal 中的 fade race 和 drag-select 错误通过最小更改修复,并通过 jsdom harness 验证。

问题

A jQuery modal plugin left open but invisible after a rapid close, and closed unexpectedly when dragging from inside to the backdrop.

结果

Both bugs were fixed with small, local changes; harnesses proved deterministic success.

工作流

  • Identify the race condition in the fade animation and the click event propagation bug.
  • Write jsdom harnesses to reproduce the failures (13 checks for fade race, 7 checks for drag-select).
  • Implement minimal fixes: cancel pending fade callback and guard display flip; add mousedown/mouseup logic with backdrop checks and detail fallback.
  • Run harnesses to confirm deterministic success (13/13 and 7/7).
  • Publish patches, harnesses, and documentation.

证据

Call $('#m').modal() and then almost immediately $.modal.close(). The modal ends up "open" but invisible: opacity: 0, overlay still on top, and it traps every click on the page.

来源

A 13-check jsdom harness (no browser needed): ... 13/13 every run

来源

Press the mouse inside the modal, drag out onto the backdrop, release. The modal closes, even though the click started inside it.

来源

A 7-check jsdom harness: master 5/7, patched 7/7, deterministic

来源

  • 记录日期: 2026-10-20T10:41:11.423Z