Skip to content

Conversation

@jazairi
Copy link
Contributor

@jazairi jazairi commented Nov 4, 2025

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 busy attribute for reliable state detection. Turbo also adds aria-busy for screen reader users.

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.

Developer

Accessibility
  • ANDI or WAVE has been run in accordance to our guide.
  • This PR contains no changes to the view layer.
  • New issues flagged by ANDI or WAVE have been resolved.
  • New issues flagged by ANDI or WAVE have been ticketed (link in the Pull Request details above).
  • No new accessibility issues have been flagged.
New ENV
  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.
Approval beyond code review
  • UXWS/stakeholder approval has been confirmed.
  • UXWS/stakeholder review will be completed retroactively.
  • UXWS/stakeholder review is not needed.
Additional context needed to review

The spinner should appear on tab changes and pagination changes.

Code Reviewer

Code
  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.
Documentation
  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.
Testing
  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@coveralls
Copy link

coveralls commented Nov 4, 2025

Pull Request Test Coverage Report for Build 19144638689

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.284%

Totals Coverage Status
Change from base Build 19083276024: 0.0%
Covered Lines: 859
Relevant Lines: 874

💛 - Coveralls

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-134-avelx29wx November 4, 2025 19:24 Inactive
@djanelle-mit
Copy link
Contributor

djanelle-mit commented Nov 4, 2025

Aesthetically this looks really solid! Really helpful to see the loading indication. Couple questions about the implementation:

  • It looks like it's centered on the browser right now, if we wanted it to appear in the context of the page contents itself (to make it looks like the tab is loading not the entire page), would that be doable?
  • Can/should we split the spinner off from the results style partial and put it in it's own partial? Is this something that could be reused by other places besides the results section? Starting to think ahead to treating this as a modular component.

@jazairi
Copy link
Contributor Author

jazairi commented Nov 4, 2025

Thanks for the quick review, @djanelle-mit!

  • It looks like it's centered on the browser right now, if we wanted it to appear in the context of the page contents itself (to make it looks like the tab is loading not the entire page), would that be doable?

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?

  • Can/should we split the spinner off from the results style partial and put it in it's own partial? Is this something that could be reused by other places besides the results section? Starting to think ahead to treating this as a modular component.

Good question. I think it makes sense to modularize it, even if we're not sure yet if it will be reused.

@jazairi jazairi temporarily deployed to timdex-ui-pi-use-134-avelx29wx November 5, 2025 20:31 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-134-avelx29wx November 6, 2025 16:43 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-134-avelx29wx November 6, 2025 17:04 Inactive
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.
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-134-avelx29wx November 6, 2025 17:42 Inactive

// Show the progress bar after 200 milliseconds, not the default 500
window.Turbo.setProgressBarDelay(200);
Turbo.config.drive.progressBarDelay = 200;
Copy link
Member

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.

https://mitlibraries.atlassian.net/browse/USE-166

Copy link
Contributor Author

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. :)

@jazairi jazairi merged commit 9267108 into main Nov 6, 2025
5 checks passed
@jazairi jazairi deleted the use-134 branch November 6, 2025 18:56
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.

6 participants