Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Popup fails to open when built on its own #5742
Steps to reproduce:
At this point, the popup fails to appear on the screen. The reason:
The popup attaches to "beforenavigate", and completes its opening sequence in response to the event.
Unfortunately, when build without init, the library does not call _registerInternalEvents(), which would cause a "navigate" binding to be added which, in turn, would cause the navigate special event's setup function to be called.
Popup uses "beforenavigate" before it attaches to navigate. "beforenavigate" is emitted by the navigate event code in addition to the navigate event. However, since it first attaches to "beforenavigate" and only then to "navigate", it never attaches to "navigate", meaning that, unless init runs as part of library load, the "navigate" event will not be initialized, and thus the popup will never receive the "beforenavigate" event it needs to complete the opening sequence.
It fails to close because it hooks up to the body to receive nav events, however, nav events are fired on the window. When there is no page life cycle handler, pagebeforechange events are not fired on the body, so the popup does not react at all. Solution? Forget about this.options.container, and listen on the window. Let's see if this has any negative consequences ...