rolfosian / drgmissions

drg current and upcoming missions api
https://doublexp.net/
8 stars 0 forks source link

User agent stylesheet overriding some biome mission div style.display attributes seemingly at random after long periods of browser tab inactivity #9

Closed rolfosian closed 3 months ago

rolfosian commented 4 months ago

image

Honestly not sure why this is happening or how to fix it other than doing something like this which I think would be very dirty and yucky

        document.addEventListener('focus', () => {
            function biomeMissionsDivFix(div) {
                let h2s = div.querySelectorAll('h2')
                for (let i = 0; i < h2s.length; i++) {
                    let h2 = h2s[i]
                    let subDiv = h2.querySelector('div')
                    subDiv = subDiv.querySelector('div')
                    if (subDiv.style.display != 'block') {
                        subDiv.style.display = 'block'
                    }
                }
            }
            let curr = document.getElementById('current')
            let upcom = document.getElementsByName('upcom')
            biomeMissionsDivFix(curr)
            biomeMissionsDivFix(upcom)

        });

Edit: Ok I think it was a bug with the browser itself (Google Chrome). I noticed it had begun happening every time I tabbed over in both incognito and a normal profile, and I opened the site in Vivaldi and it wasn't happening there. I guess it makes sense because my session was days if not weeks old. I'll keep monitoring and see if I feel like putting a head style dom element refresh fix for it, but I'd rather google would just get it together honestly, and I don't liek the idea of 304ing the stylesheet every visibility change so it'll have to go into session/local storage too.

rolfosian commented 3 months ago

havent noticed it happening since. was def a browser bug to do with the session being weeks old