I'm facing an issue with my hero section that is supposed to take up the full height of the viewport. I recently tried using the new svh/lvh
units, which seemed to work fine on desktop and Safari for mobile. However, when testing on Chrome for mobile (specifically on an iPhone), the hero section initially displays correctly but then resizes as I scroll down, causing other elements on the page to move due to the appearance of the navigation bar at the bottom.
Here's the code snippet for the container of the hero section:
<Box
// ref={observe}
sx={{
width: "100vw",
height: "100vh",
width: "100svw",
height: "100svh",
position: "relative",
}}
>
Although using height: fill-available;
solves the problem on Chrome mobile, it causes issues on other browsers.
I even removed the fallbacks 100vh
and 100vw
to ensure that the mobile browser was indeed using the correct svh
units, which it was.
Any insights into what might be causing this behavior?