use window.innerHeight instead of document.documentElement.clientHeight #74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After experimenting in BrowserStack with Safari on iOS versions from 10 to 15, I can confirm that
document.documentElement.clientHeight
is only updated after orientation change, soresize
events caused by shrinking / enlarging of the URL panel don't have effect ondocument.documentElement.clientHeight
, whilewindow.innerHeight
is being updated.For reference (it was mentioned in #22 - the original reason to switch from
window.innerHeight
todocument.documentElement.clientHeight
, something that I revert here) - trying to extract values fromdocument.documentElement.clientHeight
andwindow.innerHeight
won't work properly in theorientationchange
event handler (the values are gibberish as the 4,5 year old bug https://bugs.webkit.org/show_bug.cgi?id=170595 is still not resolved), but iOS firesresize
event afterorientationchange
where at leastwindow.innerHeight
looks correct, so I don't debounceorientationchange
and rely on theresize
event that follows.I noticed that iOS 15 fires way more
resize
events on URL bar size change, so debouncing might still be necessary. But I will leave that for another update.I also tried in Chrome on Android versions 8-11, the behavior is identical to iOS.