Skip to content

fix: force layout recalculation on window visibility change#20

Merged
dakl merged 1 commit intomainfrom
halfscreen
Mar 23, 2026
Merged

fix: force layout recalculation on window visibility change#20
dakl merged 1 commit intomainfrom
halfscreen

Conversation

@dakl
Copy link
Copy Markdown
Owner

@dakl dakl commented Mar 23, 2026

Summary

  • Adds a visibilitychange event listener that dispatches a synthetic resize event when the document becomes visible
  • Fixes an intermittent bug where the bottom half of the app renders blank after returning from another app/space/sleep

Context

macOS can report stale viewport dimensions when restoring a window (e.g. switching spaces, waking from sleep), causing 100vh to resolve incorrectly. The ResizeObserver on terminal containers doesn't fire because the window size hasn't changed — only the viewport calculation is stale. Dispatching a synthetic resize forces a full layout recalculation.

Test plan

  • 217/217 unit tests pass
  • 6/7 E2E tests pass (1 pre-existing flaky timeout)
  • Manual verification in dev mode

🤖 Generated with Claude Code

macOS can report stale viewport dimensions when restoring a window
(e.g. switching spaces, waking from sleep), causing the bottom half
of the app to render blank. Dispatching a synthetic resize event on
visibilitychange forces a full layout recalculation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dakl dakl merged commit 0cf3e89 into main Mar 23, 2026
3 checks passed
@dakl dakl deleted the halfscreen branch March 23, 2026 20:53
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