Skip to content

[Bug]: Navigating PR panel headings in NVDA browse mode jumps focus back to "Open pull request #<n> on host" #39834

Closed

Description

@nibarAhmed

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Start NVDA on Windows and open T3 Code (desktop app or web).
  2. Open a pull request in the PR detail panel that has a description long enough to scroll and at least one comment (for example, #39757).
  3. Using NVDA in browse mode, press H repeatedly to move through headings down to the comment heading.

Expected behavior

Pressing H in browse mode moves cleanly through the PR title, any headings in the description, and down to the comment headings without moving focus back to the panel header.

Actual behavior

Once browse-mode heading navigation scrolls the PR body far enough to condense the PR header, NVDA jumps back to the Open pull request #<number> on host button at the top of the PR panel instead of staying on the heading. Pressing H again from there moves to a heading near the top of the description, which scrolls back to the top, uncondenses the header, and jumps back to Open pull request #<number> on host again — creating a loop that blocks reaching comments by heading.

Root cause

  1. When the PR panel opens, startWorkspaceFocus (apps/web/src/lib/workspaceFocus.ts) moves DOM focus to the panel's first visible focusable control — inside the expanded crumbs row in PullRequestDetailCrumbs (apps/web/src/components/pullRequest/PullRequestDetailCrumbs.tsx), either the repository button or Open pull request #<number> on host (matched across the ghost-to-detail transition).
  2. Navigating by heading (H) in NVDA browse mode moves the virtual cursor across non-focusable headings (<h1> title, Markdown headings in the description, comment <h2>), so DOM document.activeElement stays behind on that control in the expanded header.
  3. When NVDA scrolls a lower heading into view and the tab scroller's scrollTop exceeds foldHeight + 32, PullRequestDetailPanel's onScrollCapture (apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx) sets condensed = true.
  4. Setting condensed = true applies inert to the expanded crumbs row (PullRequestDetailCrumbs.tsx) and to foldRef (PullRequestDetailPanel.tsx), which blurs document.activeElement to document.body and fires focusout with relatedTarget === null.
  5. createWorkspaceFocusController's recover handler (apps/web/src/lib/workspaceFocus.ts) catches that focusout on the next animation frame and programmatically focuses the newly un-inert Open pull request #<number> on host button in the condensed crumbs row — either by matching aria-label (remounted) when that button held focus, or by falling back to focus("panel") -> surfaceControl (where the condensed Open pull request #<number> on host button is the first focusable control in the panel whenever no back button is shown).
  6. That programmatic .focus() call pulls NVDA's browse-mode cursor back up to Open pull request #<number> on host. If the user presses H again, moving to a heading near the top of the description scrolls scrollTop below 4, flipping condensed back to false, marking the condensed crumbs row inert, and causing recover to focus the expanded row's Open pull request #<number> on host button again.

(The same condensed / inert header swap also runs on the Timeline and Code tabs via scrollerByTab whenever DOM focus remains in the collapsible header.)

Impact

Major degradation or frequent failure

Version or commit

main @ c813e7d

Environment

Windows, NVDA (browse mode), T3 Code web/desktop UI

Workaround

Press Tab to move DOM focus past the PR header (for example, into the PR tab bar or inside the Summary/Timeline body) before using H in browse mode, or open the pull request on the host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions