timescale.info
Sign inSign up

How OpenChronology was built

Every merged pull request of openchronology/timeline-app, its first week of commits and its releases; and before them the 2020 PureScript editor, from snapshots of its deleted repositories in the Wayback Machine. Written to this server through the HTTP API.

327 moments · 2020-03-09T00:15:08Z CE – 2026-11-02T20:11:21Z CE · by @athan · @athan

#322 · A stale scroll event no longer closes the timeline menu

  • timeline-app
  • pull request

Closes #308. **Cause.** This was an app bug, not only a test flake. The timeline menu closed on any `scroll` event (`window.addEventListener('scroll', closeTimelineMenu, true)`). Browsers deliver a scroll's event in the frame after the scroll itself. When a right-click or long press lands just after a scroll, the event for that earlier scroll arrives after the menu has opened and closes it immediately. Instrumenting the test showed exactly this, in 10 of 10 isolated runs: 1. Playwright scrolls the band into view (`scrollY` 0 → 95). 2. It right-clicks at once, and `contextmenu` opens the menu. 3. About 5 ms later, a `scroll` event arrives with `scrollY` still 95 and closes it. A user right-clicking or long-pressing just after a fling could hit the same thing. **Fix** (`src/app.ts`, in the menu code only): - `showTimelineMenu` records the element under the opening point and its position. - A scroll now closes the menu only once that element has moved (by a pixel or more) or left the document. - Real scrolls of the page, or of a dialog the menu belongs to, still close it. **Test** (`test/duration-backgrounds-browser.mjs`): before the existing right-click, the page scrolls and dispatches `contextmenu` on the band in the same frame, waits two frames, and requires the menu to be open. Without the fix it fails, 3 of 3. The existing right-click → Fit in view step follows unchanged. **Evidence** (Playwright 1.58.2 container): - **The duration-backgrounds check on its own:** Chromium 0 failures in 15 runs (10 of 10 failed before the fix); Firefox and WebKit 0 in 3 each. - **The full `test/browser.mjs`:** passes in Chromium (locally it had stopped at this step), Firefox and WebKit. - **`npm test`:** 325 of 325.

Sources

Open #322 · A stale scroll event no longer closes the timeline menu in the timeline