-
Notifications
You must be signed in to change notification settings - Fork 0
Add loading spinner for Turbo Frame updates #264
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
Conversation
Pull Request Test Coverage Report for Build 19144638689Details
💛 - Coveralls |
|
Aesthetically this looks really solid! Really helpful to see the loading indication. Couple questions about the implementation:
|
|
Thanks for the quick review, @djanelle-mit!
Most likely, yes. Centering was a cheap path to get it to show even when users are at the bottom of a results list, waiting for the next page to load. I could imagine replacing the results content with the spinner, or something to that effect, to make it clearer that just that region is loading?
Good question. I think it makes sense to modularize it, even if we're not sure yet if it will be reused. |
Why these changes are being introduced: Users experience long delays when switching between pages due to slow Primo API responses, with no visual feedback indicating that the system is processing their request. Relevant ticket(s): - [USE-134](https://mitlibraries.atlassian.net/browse/USE-134) How this addresses that need: This adds a CSS spinner animation that appears during Turbo Frame updates. It uses Turbo's built-in `busy` attribute for reliable state detection. Turbo also adds `aria-busy` for screen reader users. Changing pages also now scrolls to the top of the page and refocuses on the first result of the next page. Side effects of this change: - Adds data-turbo-action="advance" to search results frame. - Spinner may briefly show during fast API responses. - Deprecated Turbo API syntax has been updated to current syntax. - This is different the from built-in Turbo progress bar that we use for page reloads, as that feature is not available for Turbo Frame updates. It's fairly straightforward to rebuild in JS if we decide we want consistent loading progress indicators.
|
|
||
| // Show the progress bar after 200 milliseconds, not the default 500 | ||
| window.Turbo.setProgressBarDelay(200); | ||
| Turbo.config.drive.progressBarDelay = 200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, I think I opened a separate ticket for this yesterday so you can grab it, move it to the Sprint, and Done it when this merges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol I didn't bother mentioning it on the other PR since I knew I had it here. :)
Why these changes are being introduced:
Users experience long delays when switching between search tabs due to slow Primo API responses, with no visual feedback indicating that the system is processing their request.
Relevant ticket(s):
How this addresses that need:
This adds a CSS spinner animation that appears during Turbo Frame updates. It uses Turbo's built-in
busyattribute for reliable state detection. Turbo also addsaria-busyfor screen reader users.Side effects of this change:
Developer
Accessibility
New ENV
Approval beyond code review
Additional context needed to review
The spinner should appear on tab changes and pagination changes.
Code Reviewer
Code
added technical debt.
Documentation
(not just this pull request message).
Testing