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

Hide the navigation loader when the page is shown #1359

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

greg-does-weather
Copy link
Collaborator

What does this PR do? 🛠️

When the user clicks the back button, the previous page is not necessarily reloaded. Most of the time, the previous page and its entire state are "popped" from a history stack. There is a a pageshow event that is fired every time a page is shown, however, and that event subscription persists in the history state. By subscribing to that event when page A is first loaded, then when the user navigates to page B and clicks the back button to come back to page A, we can know that page A is – from the user's perspective – reloading. When this event fires, we hide the navigation loader.

Note

This pageshow event is fired after the page is visually restored for the user, so there is a quick flash of the navigation loader before it is hidden. There is an experimental pagereveal event that is fired before visual rendering, but it is not through the standards process yet and is not widely-supported outside of Chrome.

Sometimes the browser will evict a page's state from the browser stack (for example, to reclaim memory if there are too many pages in the stack). In that case, the page is reloaded from scratch. In this case, the navigation loader will be hidden by default.

Copy link
Contributor

This PR modifies theme Javascript or CSS assets but does not update the theme libraries file. Did you mean to update the appropriate version information in the libraries file?

@greg-does-weather greg-does-weather changed the title hide nav loader on page show Hide the navigation loader when the page is shown Jun 24, 2024
@greg-does-weather greg-does-weather merged commit dd4071c into main Jun 25, 2024
14 checks passed
@greg-does-weather greg-does-weather deleted the mgwalker/1323-loading-indicator-back-button branch June 25, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading indicator persists after clicking back button
2 participants