Skip to content

Keep the desktop playground starfield animating on Safari before 17.4, which lacks checkVisibility - #1874

Open
dormouse-bot wants to merge 1 commit into
mainfrom
fix/playground-starfield-checkvisibility
Open

dormouse-bot wants to merge 1 commit into
mainfrom
fix/playground-starfield-checkvisibility

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

On Safari before 17.4, the desktop playground's starfield freezes and the console fills with TypeErrors. isShown in website/src/pages/PlaygroundDesktop.tsx called element.checkVisibility() with no guard on the method. TutRunner's background tick calls isShown() every 33 ms on every starfield screen, so on those browsers each tick threw before advance() and render(). Safari added checkVisibility in 17.4. The website builds with Vite 8's default target, which still includes Safari 16.4 and doesn't polyfill DOM methods.

The check moves into terminalElementShown in website/src/lib/tut-runner.ts. Where the browser has checkVisibility it uses it, so behavior there is unchanged. Without it, a connected element counts as shown, which still pauses a minimized pane, whose xterm element is detached. lib/src/stories/settle-terminals.ts already guards the same call the same way. The new terminalElementShown tests in tut-runner.test.ts cover an element with no checkVisibility, which the old expression threw on. tsc and the file's tests pass.

…heckVisibility

isShown called element.checkVisibility() unguarded, so on Safari before 17.4
every starfield tick threw before advancing or rendering. terminalElementShown
falls back to isConnected there.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: b20a2f6
Status: ✅  Deploy successful!
Preview URL: https://5090fed6.mouseterm.pages.dev
Branch Preview URL: https://fix-playground-starfield-che.mouseterm.pages.dev

View logs

This branch has not been deployed

No deployments
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