Skip to content

fix: keep TreeView paging on visible items - #8761

Open
nemo-crypto wants to merge 1 commit into
primer:mainfrom
nemo-crypto:fix/treeview-visible-paging
Open

nemo-crypto wants to merge 1 commit into
primer:mainfrom
nemo-crypto:fix/treeview-visible-paging

Conversation

@nemo-crypto

Copy link
Copy Markdown

TreeView's PageUp/PageDown navigation currently counts descendants of collapsed tree items. This can select a hidden item as the next focus target, unlike the existing arrow-key navigation. When the scroll container is shorter than one row, the page size also becomes zero and the calculated target is undefined.

Count only items outside collapsed subtrees for both paging directions and clamp the page size to at least one row. Keep the existing page-relative movement and first/last-item clamping.

Changelog

New

  • Browser regressions covering both paging directions, collapsed children, containers shorter than one row, and first/last-item boundaries.

Changed

  • TreeView paging skips collapsed descendants and remains usable in a short scroll container.
  • Add a patch changeset for @primer/react.

Removed

  • None.

Rollout strategy

  • No changes needed in github/github-ui
  • Needs changes in github/github-ui
  • Ships with feature flag(s)
  • Not sure
  • None

Testing & Reviewing

  • Six regression cases fail on the original implementation; all pass with the fix.
  • TreeView tests: 149 passed in Chromium.
  • Full npm test -- --run: 163 files passed, 3,106 tests passed, 3 skipped, 10 todo.
  • npm run build, npm run type-check, npm run lint:fix, npm run lint:css, and npm run format:diff pass.

Prepared with AI assistance; the regressions and fix were verified locally.

@nemo-crypto
nemo-crypto requested a review from a team as a code owner November 16, 2026 01:52
@changeset-bot

changeset-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f6b442a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch was successfully deployed

1 active deployment
github-pages — f6b442a7 Deployed Nov 16, 2026 by nemo-crypto via deploy-preview #30630
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.

2 participants