Skip to content

Conversation

@JPrevost
Copy link
Member

@JPrevost JPrevost commented Nov 5, 2025

Why are these changes being introduced:

  • Running multiple searches always reset to the Primo tab. It is expected that isn't what users want. They want to stay on the tab they selected.

Relevant ticket(s):

How does this address that need:

  • Updates the tab links to set a cookie with the selected tab when clicked.
  • Updates the search form to include the active tab as a hidden field so that when a new search is performed, the selected tab is preserved.
  • Updates the Tabs Turbo Frame to target the whole page to allow the form element to be updated
    • This also fixed the issue with back links not updating the form keyword input correctly which was a separately reported bug.

Document any side effects to this change:

  • Refactor to extract some logic from the SearchController to ApplicationController to allow reuse in BasicSearchController.
  • Minor refactor to conditional logic to always use case and eliminate the if statement that was used only for GeoData. Also normalized to geodata language (was gdt) to match other wording used in the app.

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

E.g., if the PR includes updated dependencies and/or data
migration, or how to confirm the feature is working.

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.

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-135-st-wsklwl November 5, 2025 20:34 Inactive
@coveralls
Copy link

coveralls commented Nov 5, 2025

Pull Request Test Coverage Report for Build 19171924982

Details

  • 22 of 26 (84.62%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 97.865%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/controllers/search_controller.rb 12 16 75.0%
Totals Coverage Status
Change from base Build 19146580890: -0.4%
Covered Lines: 871
Relevant Lines: 890

💛 - Coveralls

@JPrevost JPrevost force-pushed the use-135-sticky-tabs branch from f6e2169 to fa50823 Compare November 5, 2025 20:35
@JPrevost JPrevost temporarily deployed to timdex-ui-pi-use-135-st-wsklwl November 5, 2025 20:35 Inactive
}

/* temp style to visualize active tab. Save us from this Dave! */
#tabs .active{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djanelle-mit just tagging you so you know where to remove my amazing code when you pull the tab work soon!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the tag and the comment in the css, too!

@jazairi jazairi self-assigned this Nov 6, 2025
Copy link
Contributor

@jazairi jazairi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well locally for me. Bonus points for cleaning up a gdt instance. 🙂

In terms of how this affects #264, full page reloads will mean no spinner on tab changes. However, I think that's perfectly fine. We still get the loading bar that Turbo provides for free, which is consistent with the loading behavior for an initial search (also a full page reload).

Please make sure to notify UXWS of this during QA. I spoke with Darcy this morning about loading indicators, and she currently expects a spinner over the results list for both pagination and tab changes. This PR means we will instead get the loading bar for tab changes, with the spinner for pagination changes.

I should note that if UXWS does want the spinner for tab changes, that may still be possible -- I just want to make sure they are aware that this impacts that.

Why are these changes being introduced:

* Running multiple searches always reset to the Primo tab. It is
  expected that isn't what users want. They want to stay on the tab
  they selected.

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/USE-135
* https://mitlibraries.atlassian.net/browse/USE-156

How does this address that need:

* Updates the tab links to set a cookie with the selected tab
  when clicked.
* Updates the search form to include the active tab as a hidden
  field so that when a new search is performed, the selected tab
  is preserved.
* Updates the Tabs Turbo Frame to target the whole page to allow the
  form element to be updated
  * This also fixed the issue with back links not updating the form
    keyword input correctly which was a separately reported bug.

Document any side effects to this change:

* Refactor to extract some logic from the SearchController to
ApplicationController to allow reuse in BasicSearchController.
* Minor refactor to conditional logic to always use case and eliminate
  the if statement that was used only for GeoData. Also normalized to
  `geodata` language (was `gdt`) to match other wording used in the app.
@JPrevost JPrevost force-pushed the use-135-sticky-tabs branch from fa50823 to ed6ef11 Compare November 6, 2025 18:58
@JPrevost JPrevost temporarily deployed to timdex-ui-pi-use-135-st-wsklwl November 6, 2025 18:58 Inactive
Why are these changes being introduced:

* Initial implementation used full page refresh but that removed the
  desired spinners

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/USE-135

How does this address that need:

* Moves back to target content refresh with turbo frame
* Adds JavaScript to update hidden form element and set active class
  on tab
* Introduces Feature to slow down fast requests when testing page
  elements that are fleeting like spinners/loaders
@JPrevost JPrevost temporarily deployed to timdex-ui-pi-use-135-st-wsklwl November 7, 2025 14:49 Inactive
@JPrevost JPrevost requested a review from jazairi November 7, 2025 14:54
Copy link
Contributor

@jazairi jazairi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent refactor. The new JS is minimal and straightforward, and the latency feature is a nice addition. I'm still seeing the cookie get set as expected. Glad this was relatively easy to implement!

@JPrevost JPrevost merged commit 32f45ed into main Nov 7, 2025
5 checks passed
@JPrevost JPrevost deleted the use-135-sticky-tabs branch November 7, 2025 18:09
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