Question: I'm facing an issue with my layout involving overflow, fixed, and sticky elements in mobile mode. Here's the scenario:
I have content presented in tables, and the first table needs to have a sticky header. Because of this requirement, I can't wrap all tables in an overflow container. Instead, I've nested a div to make it position sticky, and the child element has overflow-x: scroll.
Here's a simplified structure:
This layout functions as intended in desktop mode and as long as I view it in responsive mode in browser dev tools. However, when I switch to "Device Emulation Mode (Specific Models)," something changes in how position: fixed and position: sticky elements behave, and it no longer works as expected.
Specifically, the position: fixed elements now inherit the width of sibling elements with overflow, and the position: sticky behavior is disrupted.
I've even tested this on a real mobile device, and the issue persists.
Could someone shed light on what might be happening here, and perhaps provide suggestions for alternative approaches to handling this layout challenge on mobile devices? Your insights would be greatly appreciated.
Here is a link so you can see for yourself in web development mode. https://sunny-souffle-948467.netlify.app/
Your CSS works fine. Have a look at your JavaScript.
The class scrollTime is not added on mobile. Try to set minimum-scale=1 in the meta section.
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1">
This is a Chrome thing.
Look at this: Not a top of the page but window.scrollY equals 0 on chrome mobile browser