Skip to content

fix: show loading spinner reliably in Safari#94

Merged
atoomic merged 1 commit intometacpan:masterfrom
Koan-Bot:koan.atoomic/fix-safari-loading-spinner
Mar 15, 2026
Merged

fix: show loading spinner reliably in Safari#94
atoomic merged 1 commit intometacpan:masterfrom
Koan-Bot:koan.atoomic/fix-safari-loading-spinner

Conversation

@Koan-Bot
Copy link
Contributor

What

Fix the loading overlay ("Grepping...") not appearing in Safari when performing a search.

Why

Safari stops rendering once form submission triggers page navigation. The previous implementation used setInterval to fade in the overlay from opacity 0 → 1, but the interval callback never fires because Safari freezes JS execution during navigation. Result: users see a blank white page instead of the spinner. (Issue #37, open since 2017.)

How

  • Prevent default form submissiondoGrepping() now returns false to block the native submit
  • Double requestAnimationFrame — ensures the browser completes a paint cycle (showing the overlay) before we call form.submit() programmatically
  • CSS @keyframes fade-in replaces the JS setInterval animation — CSS animations are composited on the GPU and survive the navigation freeze in most browsers
  • Added id="search-form" to the homepage form and fixed both forms to use onSubmit="return doGrepping()" so the return value is honored

Testing

  • JS syntax validated locally (node --check)
  • Full test suite requires Docker (CI will cover)
  • Manual testing needed on Safari, Chrome, and Firefox to confirm spinner visibility

Closes #37

🤖 Generated with Claude Code

Safari stops rendering once form submission (page navigation) begins,
which killed the setInterval-based fade-in — the overlay appeared at
opacity 0 and the animation never ran, showing a blank white page.

Fix: prevent default form submission, show the overlay at full opacity,
use double requestAnimationFrame to guarantee a paint, then submit
programmatically. The fade-in is now a CSS @Keyframes animation which
is more reliable across browsers than JS timers.

Also adds id="search-form" to the homepage form and fixes both forms
to use `onSubmit="return doGrepping()"` so the return value is honored.

Closes metacpan#37

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atoomic atoomic marked this pull request as ready for review March 14, 2026 13:50
@atoomic atoomic merged commit 4580f71 into metacpan:master Mar 15, 2026
1 check passed
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.

Safari do not display the "Load" spinner when performing a search

2 participants