In case your viewport height on Chrome/Android is unexpectedly shifting

I encountered a weird bug whereby the initial viewport height exceeded the length of the page on Chrome/Android. But when I tapped on the page, it “snapped” back to the expected dimensions. Apparently this is a known issue:

“The clientHeight property has a wrong value when a page is loaded for the first time and the user’s keyboard was visible when triggering the navigation. Then, on the first interaction with the page, a shift happens.”

Fortunately there’s a quick fix: adding interactive-widget=resizes-content to the viewport meta tag fixes the issue. I say quick fix, but… I spent hours trying to debug :wink: so I’m sharing to help others avoid the headache.

2 Likes