`clean-repo-tabs` - Restore feature by daresTheDevil · Pull Request #9185 · refined-github/refined-github · GitHub
Skip to content

clean-repo-tabs - Restore feature#9185

Draft
daresTheDevil wants to merge 2 commits intorefined-github:mainfrom
daresTheDevil:fix/clean-repo-tabs-react-nav
Draft

clean-repo-tabs - Restore feature#9185
daresTheDevil wants to merge 2 commits intorefined-github:mainfrom
daresTheDevil:fix/clean-repo-tabs-react-nav

Conversation

@daresTheDevil
Copy link
Copy Markdown

@daresTheDevil daresTheDevil commented Apr 12, 2026

Part of #8867 (partially -- clean-repo-tabs only, other affected features are separate)

GitHub replaced the repo nav with a React UnderlineNav component. Every selector in clean-repo-tabs was targeting DOM that no longer exists -- hotkey attributes, .selected, .Counter, .UnderlineNav-body, the overflow dropdown mechanism. The feature was silently doing nothing.

What changed

  • Tab discovery switched to [data-tab-item="..."] selectors in selectors.ts. Plain strings, not arrays -- old DOM support dropped per @fregante's feedback.
  • mustKeepTab checks aria-current="page" instead of .selected
  • setTabCounter / getTabCount target [data-component="counter"] instead of .Counter / .num
  • hideTab uses li.hidden = true instead of the old onlyShowInDropdown mechanism. React handles the remaining layout correctly, no visual glitches.
  • Removed moveRareTabs and its dependency on unhideOverflowDropdown from more-dropdown-links. Security and insights tabs just get hidden directly.
  • Dropped deduplicate: 'has-rgh' per the migration tracked in 🍰 Code migrations #7000. The init functions already bail early when tabs don't exist or mustKeepTab returns true, so re-running on SPA navigation is safe. Cached API calls (wikiPageCount, hasActionRuns) prevent redundant fetches.

Test URLs

Screenshot

Tested across all URLs above. Tabs hide correctly on both hard refresh and SPA navigation.
CleanShot 2026-04-11 at 21 55 07@2x
CleanShot 2026-04-11 at 21 55 55@2x
CleanShot 2026-04-11 at 21 56 38@2x
CleanShot 2026-04-11 at 21 57 24@2x
CleanShot 2026-04-11 at 21 57 58@2x

GitHub replaced the repo nav with a React Primer UnderlineNav component,
breaking every code path in clean-repo-tabs. The feature was silently
doing nothing on the new DOM.

Changes:
- Find tabs via [data-tab-item] selectors instead of [data-hotkey]
- Hide tabs with li.hidden instead of the old onlyShowInDropdown()
  mechanism (dropdown no longer exists in React DOM)
- Update mustKeepTab to check aria-current="page" alongside .selected
- Update setTabCounter and getTabCount for new counter structure
  ([data-component="counter"] instead of .Counter)
- Add shared tab selectors to selectors.ts supporting old, anonymous,
  and React DOM variants
- Remove dependency on unhideOverflowDropdown from more-dropdown-links

Closes refined-github#8867
Per maintainer feedback, drop backward compat for the old DOM.
Tab selectors simplified to plain `[data-tab-item]` strings.
Remove deprecated `deduplicate: 'has-rgh'` (refined-github#7000) so the
feature re-runs correctly on SPA navigation.
@github-actions github-actions Bot added the bug label Apr 12, 2026
@daresTheDevil daresTheDevil marked this pull request as ready for review April 12, 2026 03:00
@SunsetTechuila SunsetTechuila changed the title clean-repo-tabs - Restore feature for React UnderlineNav clean-repo-tabs - Restore feature Apr 12, 2026
Copy link
Copy Markdown
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

The code looks good so far but I don't see any code adding the hidden tabs to the dropdown. We need an additional observer to append items to it. It's ok if they're not in the exact order they appear on the tab bar.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the two issues in the comment are still applicable, restore the comment

@fregante fregante marked this pull request as draft April 16, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants