Skip to content

fix: prevent scroll jump and horizontal overflow on theme transition#16

Merged
Raigato merged 1 commit intomainfrom
fix/theme-transition-scroll-and-overflow
Mar 22, 2026
Merged

fix: prevent scroll jump and horizontal overflow on theme transition#16
Raigato merged 1 commit intomainfrom
fix/theme-transition-scroll-and-overflow

Conversation

@Raigato
Copy link
Copy Markdown
Owner

@Raigato Raigato commented Mar 22, 2026

Summary

  • Save window.scrollY before the scramble animation starts and restore it with behavior: 'instant' at the end, preventing mobile browsers from scrolling when anchor innerHTML is restored
  • Switch textContent reads to innerText so the scramble only operates on visually rendered text — fixes horizontal overflow caused by the responsive CTA spans (sm:hidden / hidden sm:inline) both being included in the scramble string regardless of CSS visibility

Save and restore vertical scroll position around the theme transition to
prevent mobile browsers from scrolling when anchor innerHTML is restored.
Switch textContent reads to innerText so the scramble animation only
operates on visible text, fixing horizontal overflow caused by hidden
responsive spans being included in the scramble string.
@Raigato Raigato marked this pull request as ready for review March 22, 2026 13:16
@Raigato Raigato merged commit 86254eb into main Mar 22, 2026
4 checks 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.

1 participant