Wait a bit longer before testing viewport width

This commit is contained in:
Raymond Hill 2020-05-07 15:42:30 -04:00
parent 2d960cf530
commit b226873bdb
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -1157,6 +1157,12 @@ const getPopupData = async function(tabId) {
});
};
const nextFrames = async n => {
for ( let i = 0; i < n; i++ ) {
await nextFrame();
}
};
// The purpose of the following code is to reset to a vertical layout
// should the viewport not be enough wide to accomodate the horizontal
// layout.
@ -1171,7 +1177,7 @@ const getPopupData = async function(tabId) {
const checkViewport = async function() {
void document.body.offsetWidth;
await nextFrame();
await nextFrames(4);
const root = document.querySelector(':root');
if ( root.classList.contains('desktop') ) {