Skip to content

fix: correct fullscreen lifecycle on comparison maps - #118

Merged
vbhjckfd merged 1 commit into
route-similarity-comparison-mapsfrom
fix-comparison-map-fullscreen-lifecycle
Aug 24, 2026
Merged

fix: correct fullscreen lifecycle on comparison maps#118
vbhjckfd merged 1 commit into
route-similarity-comparison-mapsfrom
fix-comparison-map-fullscreen-lifecycle

Conversation

@vbhjckfd

Copy link
Copy Markdown
Owner

Summary

  • Collapsing a similar-route entry while its comparison map was fullscreen stranded the browser in fullscreen on a torn-down element (cmpDrop called map.remove() with no check for document.fullscreenElement).
  • Reopening/closing the same entry repeatedly stacked one fullscreenchange listener per rebuild on the same div, each closing over an already-remove()-d map instance.

Fix

  • cmpDrop: exit fullscreen before removing the map if the map's container is currently fullscreen.
  • addFullscreenControl: bind the listener once per div (_fsBound guard), and resolve the live map through the _cmpMaps registry by key at fire time instead of a closed-over m.

Route-detail maps (last column) are unaffected — they're built once and never rebuilt, so neither bug applies there.

Based on #117 (comparison-map feature) — targets that branch, not master.

Test plan

  • npx vitest run tests/actions/getAllRoutesAction.test.js (6 passed)
  • npx vitest run full suite (212 passed)
  • Verified emitted trailing <script> still parses standalone
  • Manual: expand entry, go fullscreen, collapse <details> without exiting fullscreen first — page should return to normal
  • Manual: open/close/reopen same entry a few times, confirm only one fullscreenchange listener is attached (devtools getEventListeners)

Collapsing a similar-route entry while its map was fullscreen left the
browser stranded in fullscreen on a torn-down element. Reopen/close
cycles also stacked one fullscreenchange listener per rebuild, each
closing over an already-removed map.

- cmpDrop exits fullscreen before map.remove()
- addFullscreenControl binds the listener once per div and resolves the
  live map through the _cmpMaps registry instead of a stale closure
@vbhjckfd
vbhjckfd merged commit b9721f8 into route-similarity-comparison-maps Aug 24, 2026
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.

1 participant