Skip to content

Conversation

@matt-bernhardt
Copy link
Member

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.

** Why are these changes being introduced:

We want to add an `aria-current="page"` attribute to the currently
active tab link on a results page, so that assistive technologies can
parse which is the active tab. This requires a conditional link_to call,
as well as an update to the javascript which handles tab changes.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/use-180

** How does this address that need:

Because we can't (apparently) write a conditional inside an argument to
a link_to call, we have to maintain the conditional check elsewhere -
so to prevent the source_tabs partial from becoming a mess of multiple
conditionas, we define a new search helper function, link_to_tab. This
takes a string as an argument, and is capable of outputting both a link
to the active tab, as well as to an inactive tab.

We also update loading_spinner.js to be able to maintain the state of
the aria-current attribute.

** Document any side effects to this change:

The tests for this helper function _should_ be robust enough, but I
worry that they're a bit too clever. I didn't want to just write a
string comparison assertion, because that feels very fragile given how
much this partial has been changing lately. The assertions as written
should focus on the values being present or not, but still be robust to
other changes.

Also note that, for now, the source_tabs partial is still a bit bespoke
in that there are explicitly two calls to the various tabs. I'd
originally intended to define a list in the controller, but managing the
list of tabs in this way feels awkward and like it doesn't gain anything
since the tabs are entwined with so much of the rest of the application.
Abstracting the tab order and contents to a list doesn't save us from
other complexity.
This moves the manipulation of the tabs to the click action (via a standalone function) rather than in the turbo:frame-render action.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 19308575149

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 97.875%

Totals Coverage Status
Change from base Build 19302531738: 0.01%
Covered Lines: 875
Relevant Lines: 894

💛 - Coveralls

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-180-or-ixjq7j November 12, 2025 19:00 Inactive
@matt-bernhardt matt-bernhardt merged commit f35d4ca into main Nov 13, 2025
9 checks passed
@matt-bernhardt
Copy link
Member Author

I feel the need to clarify something here for future-us. This branch wasn't merged, but an alternative PR that extended this one was. The actual changeset that merged (which included these commits, and also two additional ones) was #271 .

@matt-bernhardt matt-bernhardt deleted the use-180-original branch November 13, 2025 17:05
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.

4 participants