Windows Forms (.NET 8): first Alt into the menu bar is not announced when focus came from an MSAA-only list; MSAA focus dropped as native UIA, no UIA FocusChanged

Open
#21,051 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
accessibility

Research direction

Start by tracing NVDA's handling of MSAA EVENT_OBJECT_FOCUS and UIA FocusChanged events for Windows Forms menus; the report does not name NVDA files or tests. Reproduce with the supplied .NET 8 Windows Forms MenuStrip and MSAA-only ListView setup, comparing the first and second Alt presses. Done means the first Alt announces the focused menu item in the reported case.

Written by the indexing model from the issue text.

Description

p3 triaged

Note from the reporter: I am a blind NVDA user, not a developer of NVDA or Windows Forms. This issue was investigated and written by an AI assistant (Claude) that works on my own app. I have little technical knowledge of what is described below, so please read it at that level: the measurements are real, but the interpretation may be incomplete or wrong. I am happy to run further tests if you tell me what to do.

Steps to reproduce

Observed in our own (private) .NET 8 Windows Forms app. Not yet reproduced in a minimal app.

  1. A .NET 8 Windows Forms window with a MenuStrip (set as MainMenuStrip) and a ListView.
  2. The ListView is subclassed so that WM_GETOBJECT goes to DefWndProc. Windows then exposes it through the standard oleacc MSAA object of SysListView32 instead of the Windows Forms UIA provider. We did this because, with the .NET 8 UIA provider, NVDA stayed silent after Alt+Tab (the focused list item reports HasKeyboardFocus = false).
  3. Start the app. NVDA correctly says "PlayPal, window" and "Afspeellijst, list" (the list has focus).
  4. Press Alt once to enter the menu bar.
  5. Press Escape, then press Alt again.
Actual behavior
  • First Alt after starting the app: NVDA says nothing (0 of 9 attempts). The menu bar is active and on "File" ("Bestand"); Right Arrow moves to the next menu and is spoken.
  • Second Alt: "Bestand, collapsed, Alt+B, 1 of 4" (every time).
  • If the window is activated a second time (for example Alt+Tab away and back), the first Alt is spoken.
  • With the same app built with a plain ListView (UIA provider, no subclass), the first Alt is always spoken (5 of 5).
Expected behavior

The first Alt announces the focused menu bar item, just like the second one.

What the logs show

NVDA debug log with the MSAA and UIA categories enabled, first Alt:

  • MSAA events for the menu bar arrive (EVENT_SYSTEM_MENUSTART and EVENT_OBJECT_FOCUS with OBJID_CLIENT, childID 1, state focused), but NVDA drops them: Native UIA window. Dropping winEvent EVENT_OBJECT_FOCUS, window ... (WindowsForms10.Window.8.app...), objectID OBJID_CLIENT, childID 1.
  • Via UIA only a MenuOpened event arrives for the menu bar, which is ignored: HandleAutomationEvent: Ignoring event gainFocus because ignored by object itself.
  • No handleFocusChangedEvent arrives for the "Bestand" menu item.

Second Alt: handleFocusChangedEvent called with element Bestand menu-item ... frameworkID WinForm, then Queuing NVDA gainFocus event, and the item is spoken.

An out-of-process UIA client of our own (AddAutomationFocusChangedEventHandler) did receive a FocusChanged event for "Bestand" (HasKeyboardFocus true) on the first Alt as well. Windows sends the same MSAA events for the first and the second Alt.

So the first menu focus seems to fall between two paths: the MSAA focus is dropped because the window is native UIA, and NVDA receives no UIA FocusChanged event the first time. This may be related to the earlier focus coming from an MSAA (non-UIA) control in the same process. It may also be related to #20891 (Windows Forms menus and UIA MenuOpened), but it is a different symptom.

Our workaround: shortly after the window is shown, the app enters and leaves menu mode once (posting WM_SYSKEYDOWN/WM_SYSKEYUP for Alt and then Escape to its own window). After that, the first real Alt is spoken (5 of 5).

System configuration
NVDA installed/portable/running from source

Installed

NVDA version

2026.2 (AMD64)

Windows version

Windows 11 26H2 (10.0.26300.9550) AMD64

Name and version of other software in use when reproducing the issue

Our own app, .NET 8.0.32 Windows Forms, x64.

Other information about your system

Dutch (nl-NL) Windows and NVDA.

Other questions
Does the issue still occur after restarting your computer?

Not tested after a computer restart; it occurs after restarting NVDA.

Have you tried any other versions of NVDA? If so, please report their behaviors

No.

If NVDA add-ons are disabled, is your problem still occurring?

Not tested.

Does the issue still occur after you run the System Accessibility Repair Tool in NVDA's tools menu?

Not tested.

Dominant language
Python
Stars
2.7k
Forks
842
Avg merge
2d 4h
Merged PRs (30d)
56

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nvaccess/nvda

All issues in nvaccess/nvda

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.