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
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
If you refresh a page with the modal open sometimes it works, sometimes the modal flashes open and instantly closes leaving the url in a wrong state.
The issue is in bwa.js line 39 and 99.
The popstate event fires in chrome on the first load with an ev.state of null. This would set lightbox to null which results in the modal being closed.
The success handler for the get request on project.json also updates lightbox checking if a project matches the current url. If there is a match it sets the lightbox to the project which results in the modal being open.
What I think happens is that the project.json file request finishes first and sets the lightbox to the project which has the modal begin to open. Then the onpopstate event handler fires which immediately closes the modal leaving the url in a wrong state. Using the chrome debugger with breakpoints on 39 and 99 seems to confirm this (if 99 is first, it breaks).
Looking at this stack overflow post (http://stackoverflow.com/questions/6421769/popstate-on-pages-load-in-chrome) it seems like checking if ev.state === null and ignoring that popstate event if so might work, but I'm not sure if that is fully cross browser or would ignore legit events (I've never used the popstate event so don't really know whats valid or not).
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you refresh a page with the modal open sometimes it works, sometimes the modal flashes open and instantly closes leaving the url in a wrong state.
The issue is in bwa.js line 39 and 99.
The popstate event fires in chrome on the first load with an ev.state of null. This would set lightbox to null which results in the modal being closed.
The success handler for the get request on project.json also updates lightbox checking if a project matches the current url. If there is a match it sets the lightbox to the project which results in the modal being open.
What I think happens is that the project.json file request finishes first and sets the lightbox to the project which has the modal begin to open. Then the onpopstate event handler fires which immediately closes the modal leaving the url in a wrong state. Using the chrome debugger with breakpoints on 39 and 99 seems to confirm this (if 99 is first, it breaks).
Looking at this stack overflow post (http://stackoverflow.com/questions/6421769/popstate-on-pages-load-in-chrome) it seems like checking if
ev.state === null
and ignoring that popstate event if so might work, but I'm not sure if that is fully cross browser or would ignore legit events (I've never used the popstate event so don't really know whats valid or not).The text was updated successfully, but these errors were encountered: