You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reproduce this bug, all conditions below need to be met.
Use iPad (iOS)
Use Chrome. Other browsers, e.g. Safari, Firefox, are working fine.
Open the website by clicking a link and open a new tab (<a target="_blank"/>). Directly type the url in address bar or reload the page will not reproduce the bug.
Actual solution: We need to combine all of the following techniques
Use min value between window.innerHeight and document.documentElement.clientHeight instead of rely on pure document.documentElement.clientHeight
Why?: document.documentElement.clientHeight return a wrong value. It shows a static value which is the content height + the URL bar. Whereas, window.innerHeight shows a dynamic value depending on there is the URL bar or not.
Revise UX, force a user to click the adjust screen button at first visit
Why?: window.innerHeight will show the correct value only after the first resize event occurs. The mechanism of opening a new tab is:
The website is loaded in a new tab. The URL bar appears. window's load event is triggered.
At this stage, window.innerHeight = document.documentElement.clientHeight = the content height + the URL bar
The window's resize event is triggered rapidly
At this stage, window.innerHeight = the content height. Whereas, document.documentElement.clientHeight = the content height + the URL bar
We want to use the content height. Alternative solution is to listen to window's resize event, but in that case we need to handle the resize event that is triggered from a soft keyboard?
To reproduce this bug, all conditions below need to be met.
<a target="_blank"/>
). Directly type the url in address bar or reload the page will not reproduce the bug.Steps:
Possible solution:
Actual solution: We need to combine all of the following techniques
window.innerHeight
anddocument.documentElement.clientHeight
instead of rely on puredocument.documentElement.clientHeight
document.documentElement.clientHeight
return a wrong value. It shows a static value which is the content height + the URL bar. Whereas,window.innerHeight
shows a dynamic value depending on there is the URL bar or not.window.innerHeight
will show the correct value only after the firstresize
event occurs. The mechanism of opening a new tab is:window
'sload
event is triggered.window.innerHeight
=document.documentElement.clientHeight
= the content height + the URL barwindow
'sresize
event is triggered rapidlywindow.innerHeight
= the content height. Whereas,document.documentElement.clientHeight
= the content height + the URL barwindow
'sresize
event, but in that case we need to handle theresize
event that is triggered from a soft keyboard?The text was updated successfully, but these errors were encountered: