react-div-100vh icon indicating copy to clipboard operation
react-div-100vh copied to clipboard

Mobile chrome browser on Android requires a tap for div to show

Open jasan-s opened this issue 2 years ago • 4 comments

I visited https://react-div-100vh.vercel.app/ using my pixel 7 pro with Chrome. On initial load the after visiting the link the green div is not viewable, after tapping on screen the green div appears at bottom of screen.

jasan-s avatar Feb 15 '23 01:02 jasan-s

I had/have the same exact issue and had to make a complex solution involving reading innerHeight on load before anything else has happened. Otherwise it changes.

https://github.com/DustinBrett/daedalOS/issues/274

DustinBrett avatar Apr 09 '23 17:04 DustinBrett

You should use the official css viewport variants, like 100svh which replicates what this library is trying to solve. https://caniuse.com/viewport-unit-variants

For this specific bug, those viewport units do not work.

There are a few issues related to this, but from what I have seen, it's an actual bug in mobile Chrome. It may be resolved at this point, but at the time before I had a solution, no viewport units helped this bug which actually changes the height upon interaction, which viewport units aren't related to.

DustinBrett avatar Apr 05 '24 18:04 DustinBrett

You should use the official css viewport variants, like 100svh which replicates what this library is trying to solve. https://caniuse.com/viewport-unit-variants

For this specific bug, those viewport units do not work.

Huh interesting issue, I'm glad you were able to find a workaround

aquaductape avatar Apr 05 '24 18:04 aquaductape

You should use the official css viewport variants, like 100svh which replicates what this library is trying to solve. https://caniuse.com/viewport-unit-variants

For this specific bug, those viewport units do not work.

Huh interesting issue, I'm glad you were able to find a workaround

Thanks! I am not sure if @jasan-s solved his issue, but it was a very odd and annoying one.

Based on recent comments I got from others (https://github.com/vercel/next.js/discussions/63724 & https://github.com/DustinBrett/daedalOS/issues/274#issuecomment-2020253015 [SO issue]) it may be related to something that can be solved by adding an interactive-widget flag (https://developer.chrome.com/blog/viewport-resize-behavior#changing_the_default_behavior_in_chrome_108) to the <meta name="viewport /> content.

It sounded like it could be related to going to a page when your virtual keyboard WAS open, but going to the page closes it. It seemed like you needed to click the page for it to fully resize from it's initial load when the keyboard was still closing. But that is just me guessing. It didn't seem to be the viewport units though because it seemed to have the wrong information when it was doing the calculation vs when it detected interactions on the page.

DustinBrett avatar Apr 05 '24 19:04 DustinBrett