Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird presentation behavior in Chrome #86

Open
carlhemp opened this issue Mar 1, 2021 · 2 comments
Open

Weird presentation behavior in Chrome #86

carlhemp opened this issue Mar 1, 2021 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@carlhemp
Copy link
Contributor

carlhemp commented Mar 1, 2021

I noticed recently that the browser sends an http request every time you go to a new chunk in presentation in Chrome.

I narrowed it down to this line of code:

$('#slides').css('--percent', (((current_song.chunk_index + 1) / total) * 100));

The code just sets a css variable that is used for animating the :before and :after layers that are used for a moving background.

I have no idea why this would trigger a http request! I tried changing it to vanilla js, and it still does the same behavior.

Firefox does not have this going on.

Any thoughts @evanhempel as to what may be going on? Kinda think it's gotta be a bug in Chrome...

@carlhemp carlhemp added bug Something isn't working question Further information is requested labels Mar 1, 2021
@evanhempel
Copy link
Collaborator

Using chromium I was able to reproduce, but it didn't seem to be caused by that line of code (I commented it out and the requests continued).

Looking at the Initiator for the request in the network tab of dev tools it appeared to be caused by the win.width() line in scaleText(). That's a jQuery function so I think the blame lies with them and not chrome. As a test I converted the win.width() and win.height() lines to window.innerWidth and window.innerHeight and with that change I stopped seeing the requests. That change, however, isn't a full fix since it is only getting the current window width/height and needs some additional work to function with multiple windows.

Long term, it may make sense to get rid of jQuery, I've read its fallen out of favor and I suspect we can probably do what we need for the presentation mode without additional JS libraries.

@carlhemp
Copy link
Contributor Author

Ah, thanks for finding the real culprit.

I am onboard with removing jQuery. I've been trying to use it less/not at all in new code. It would lighten our codebase load time as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants