Skip to content

USE-591: Always show active tab, even if it would be hidden in More menu#400

Merged
djanelle-mit merged 3 commits into
mainfrom
use-591
Jun 5, 2026
Merged

USE-591: Always show active tab, even if it would be hidden in More menu#400
djanelle-mit merged 3 commits into
mainfrom
use-591

Conversation

@djanelle-mit
Copy link
Copy Markdown
Contributor

@djanelle-mit djanelle-mit commented Jun 3, 2026

Developer

Because we hide tabs that don't fit the screen width, we noticed that if a tab that's hidden is the active tab it's hard to know that visually.

This work makes sure the active tab is pinned into position 2 (right after the "All" option).

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.

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Jun 3, 2026

All good ✅

Comment thread app/javascript/source_tabs.js
Comment thread app/javascript/source_tabs.js
Comment thread app/javascript/source_tabs.js
Comment thread app/javascript/source_tabs.js
@coveralls
Copy link
Copy Markdown

coveralls commented Jun 3, 2026

Coverage Report for CI Build 26964677078

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage remained the same at 98.319%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1428
Covered Lines: 1404
Line Coverage: 98.32%
Coverage Strength: 75.09 hits per line

💛 - Coveralls

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-591-uxlwm6udk June 3, 2026 13:10 Inactive
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-591-uxlwm6udk June 4, 2026 14:52 Inactive
@djanelle-mit djanelle-mit requested a review from Copilot June 4, 2026 15:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the responsive “Source tabs” navigation so that when the active tab would otherwise be hidden inside the “More” overflow menu, it is moved into the visible primary tab list (pinned to position 2, right after “All”).

Changes:

  • Refactors the tabs script into an initTabs() initializer with guards for missing tabs and repeat initialization.
  • Adds logic to detect when the active tab is hidden and reorder primary/secondary tab lists so the active tab appears in position 2.
  • Hooks initialization to turbo:load and an immediate fallback call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +36 to 42
// Store original DOM order by index for each li
Array.from(primary.querySelectorAll('li:not(.-more)')).forEach((li, index) => {
li.dataset.originalIndex = index
})
Array.from(secondary.querySelectorAll('li:not(.-more)')).forEach((li, index) => {
li.dataset.originalIndex = index
})
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was seeing a minor visual bug that become way more common with this, so avoiding for now.

Comment thread app/javascript/source_tabs.js
Comment thread app/javascript/source_tabs.js
Comment thread app/javascript/source_tabs.js
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-591-uxlwm6udk June 4, 2026 16:20 Inactive
@JPrevost JPrevost self-assigned this Jun 5, 2026
Copy link
Copy Markdown
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

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

This works. It's kinda wonky, but definitely addresses the problem as I understood it.

@djanelle-mit djanelle-mit merged commit 64ec037 into main Jun 5, 2026
6 checks passed
@djanelle-mit djanelle-mit deleted the use-591 branch June 5, 2026 13:32
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.

5 participants