Skip to content

Retain F10 menu bar action on Windows, with NVDA Screen Reader #1093

@makarius

Description

@makarius

This is an adhoc patch for FlatLaf 3.7 to retain F10 menu bar action on Windows, with NVDA Screen Reader. The problem with the special case of FlatLaf on Windows, to approximate ALT-key behaviour without showing menus yet, is that NVDA does not "show" anything to a blind user: there is no feedback on the activated menu bar.

diff -Nru FlatLaf-3.7/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java FlatLaf-3.7-patched/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java
--- FlatLaf-3.7/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java	2025-12-04 12:13:56.000000000 +0100
+++ FlatLaf-3.7-patched/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java	2026-01-26 22:52:11.575570940 +0100
@@ -380,9 +380,8 @@
 			JMenuBar menuBar = (JMenuBar) e.getSource();
 			JMenu menu = menuBar.getMenu( 0 );
 			if( menu != null ) {
-				MenuSelectionManager.defaultManager().setSelectedPath( SystemInfo.isWindows
-					? new MenuElement[] { menuBar, menu }
-					: new MenuElement[] { menuBar, menu, menu.getPopupMenu() } );
+				MenuSelectionManager.defaultManager().setSelectedPath(
+					new MenuElement[] { menuBar, menu, menu.getPopupMenu() } );
 
 				FlatLaf.showMnemonics( menuBar );
 			}

The patch returns to the uniform Unix-behaviour of Swing, e.g. in Metal L&F. It does not solve the problem completely, because the Screen Reader reports too much irrelevant details about the menu, making it barely accessible. That is further work, and a different story.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions