Files
magpie/internal/gui
yetone 1d5b5dc2da gui: the panel's visibility test takes only a hiding for a hiding (#5322)
Cause: on mote (macOS 27.2) WebKit's own document.hidden stayed true from
the page's load to the end of the run, the panel shown or not, and WebKit
fired no visibilitychange of its own (logged every 2ms in an instrumented
copy of the test). The test page dispatches visibilitychange from the
shown signal too, as app.js does; there it read hidden=true with the mark
just taken off, so it wrote marked=false play="running" as the hiding's
record and fetched /hidden. That stale /hidden sat in the host's channel,
so the panel's second round (Escape) showed the window again before its
hidden signal reached the page, and reported the stale record. The log of
a red run shows "got /hidden, show" in round 2 with no hidden signal
before it. The product is not at fault: the hidden signal reaches the
page on both of Wails' hides, and the page is paused while hidden.

Fix: the test page counts a visibilitychange as a hiding only outside the
shown signal's own dispatch.

Ran (mote, macOS 27.2, through mote-run):
- old test, -run TestPanelHiddenByWailsMarksPageOutOfSight -count=20:
  3 of 20 red with the issue's exact message.
- fixed, both visibility tests -count=20: ok, twice (the second at this
  commit's tree).
- go test ./internal/gui -count=1: ok (117.7s).
- gofmt -l internal/gui: clean.

Broken by hand, with the fix:
- WindowLostFocus no longer ExecJS's the hidden signal: 3 of 3 red
  ("timed out waiting for the page to see itself hidden").
- Escape's binding a plain w.Hide(): 3 of 3 red, the same.

Not tried: the full go test ./... — mote's suite lock had six suites
queued ahead; it is queued, and its result goes on #5322. Not tried on a
Mac with the panel really on screen (CI's runner and mote only).

Fixes #5322
2026-11-08 14:13:34 +08:00
..
…
…