Skip to content

[Bug]: Context menus opened with Shift+F10 in NVDA browse mode don't move focus into the menu (unlike the Thread Details menu) #41660

Done

Description

@nibarAhmed

Note

🤖 Antigravity posting on behalf of 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. On Windows with NVDA in browse mode, open T3 Code (web or desktop).
  2. Move the browse mode cursor onto the Thread details card and press Shift+F10. NVDA recognizes the menu and puts focus into it.
  3. Repeat with Shift+F10 from browse mode on other context menus backed by api.contextMenu.show(...) (for example: thread header/title, sidebar rows, branch/workspace controls, file browser/diff entries, right-panel tabs).

Expected behavior

Pressing Shift+F10 in NVDA browse mode on any context menu should cause NVDA to recognize it as a menu and move focus into its items, matching the Thread Details menu (ThreadDetailsPanel.tsx).

Actual behavior

The Thread Details card opens an in-DOM Base UI <Menu> / <MenuPopup> (apps/web/src/components/chat/ThreadDetailsPanel.tsx) with default modal={true}, roving tabindex, background isolation, and unconditional focus into the menu. Almost every other context menu instead goes through api.contextMenu.show(...) (apps/web/src/localApi.ts), which fails to reliably move NVDA browse mode focus into the menu:

Web (showContextMenuFallback):

  1. apps/web/src/localApi.ts drops the source ("keyboard" | "mouse") argument before calling showContextMenuFallback(items, position).
  2. apps/web/src/contextMenuFallback.ts tries to infer keyboard opening via previouslyFocusedElement?.matches(":focus-visible"). In NVDA browse mode, Shift+F10 from the virtual cursor commonly fails :focus-visible, so focus falls back to the <div role="menu" tabindex="-1"> container while every <button role="menuitem"> stays tabindex="-1".
  3. The fallback menu is non-modal: it appends a <div> to document.body without hiding or inerting the rest of the page, and its focusin listener immediately dismisses the menu if focus lands outside it.

Desktop (ElectronMenu.showContextMenu):

  1. apps/desktop/src/electron/ElectronMenu.ts only passes sourceType: "keyboard" to menu.popup(...) when callers supply source (packages/contracts/src/ipc.ts); otherwise Electron assumes mouse input and does not pre-select the first item. Most api.contextMenu.show(...) call sites still omit source (useThreadActionMenu, ChatHeader, BranchToolbar, BranchToolbarBranchSelector, RightPanelTabs, FileBrowserPanel, fileContextMenu, ThreadTerminalDrawer, MediaActions, pullRequestLinkContextMenu, ArchivedThreadsPanel).
  2. In the sidebar, apps/web/src/lib/sidebarTree.ts intercepts Shift+F10 on keydown and only dispatches the synthetic contextmenu event on keyup if document.activeElement === row, which rejects browse-mode activations when DOM focus is not already on that row.

Related issues:

Impact

Minor bug or occasional failure

Version or commit

main @ b5e1f91

Environment

Windows 11 Pro (10.0.26300), NVDA (browse mode)

Logs or stack traces

No response

Screenshots, recordings, or supporting files

No response

Workaround

Tab directly onto the target control or switch NVDA into focus mode (NVDA+Space) before pressing Shift+F10.

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