fix: prevent scroll reveal elements from flashing
All checks were successful
Test and deploy / Verify production build (push) Successful in 10m44s
Test and deploy / Deploy production (push) Successful in 5m24s

This commit is contained in:
2026-09-14 16:31:01 +03:30
parent 125dee22f0
commit 20b1b72dcd
2 changed files with 10 additions and 1 deletions

View File

@@ -79,7 +79,8 @@ export const MotionController = () => {
};
}
const initialRevealBoundary = window.innerHeight * 0.92;
// Never hide content that was already painted inside the viewport.
const initialRevealBoundary = window.innerHeight;
elements.forEach((element) => {
const bounds = element.getBoundingClientRect();
if (bounds.top <= initialRevealBoundary && bounds.bottom >= 0) {
@@ -105,6 +106,7 @@ export const MotionController = () => {
{
duration: 600,
delay: Math.min(siblingIndex * 50, 250),
fill: 'backwards',
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
},
);

View File

@@ -210,6 +210,13 @@ button:active:not(:disabled) {
border-color: transparent;
}
/* Keep pending reveals hidden only after the controller is ready. */
@media (prefers-reduced-motion: no-preference) {
html[data-motion-ready='true'] :is([data-reveal], [data-footer-reveal]):not([data-visible='true']) {
opacity: 0;
}
}
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;