RFR: 8087557: [Win] [Accessibility, Dialogs] Alert Dialog content is not fully read by Screen Reader

Kevin Rushforth kcr at openjdk.org
Wed Aug 17 13:48:35 UTC 2022


On Wed, 17 Aug 2022 08:26:48 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

> Accessibility is not implemented for JavaFX dialogs. This change is to implement the accessibility on windows platform.
> Without this fix : On Windows platform, content of Dialog are not read by Windows Narrator or JAWS.
> With this fix:
> 1. Windows narrator reads the dialog correctly
> 2. JAWS fails to read the header text. : This will be handled separately 
> 3. Behavior of VoiceOver on MacOS remains unchanged : This will be handled separately.
> 
> Verification:
> 1. Run HelloAlert toy app, with fix.
> 2. Start Windows Narrator
> 3. Click on the different buttons to show different Dialogs
> => Observe that Narrator reads all the content correctly.

I left some comments on the `AccessibleRole.DIALOG` docs. Also, I get the following exception on macOS with VoiceOver when opening any dialog:


Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read field "ptr" because "macRole" is null
	at javafx.graphics at 20-internal/com.sun.glass.ui.mac.MacAccessible.accessibilityAttributeValue(MacAccessible.java:1305)
	at javafx.graphics at 20-internal/com.sun.glass.ui.mac.MacApplication._enterNestedEventLoopImpl(Native Method)
	at javafx.graphics at 20-internal/com.sun.glass.ui.mac.MacApplication._enterNestedEventLoop(MacApplication.java:168)
	at javafx.graphics at 20-internal/com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:515)
	at javafx.graphics at 20-internal/com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
	at javafx.graphics at 20-internal/com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:631)
	at javafx.graphics at 20-internal/javafx.stage.Stage.showAndWait(Stage.java:469)
	at javafx.controls at 20-internal/javafx.scene.control.HeavyweightDialog.showAndWait(HeavyweightDialog.java:162)
	at javafx.controls at 20-internal/javafx.scene.control.Dialog.showAndWait(Dialog.java:345)
	at hello.HelloAlert.lambda$start$0(HelloAlert.java:79)
...


You will need to at least implement a stub on macOS.

modules/javafx.graphics/src/main/java/javafx/scene/AccessibleRole.java line 832:

> 830:      * <ul>
> 831:      * <li> {@link AccessibleAttribute#TEXT} </li>
> 832:      * <li> {@link AccessibleAttribute#ROLE_DESCRIPTION} </li>

What is the purpose of adding `ROLE_DESCRIPTION` here? It isn't listed anywhere else except as an optional `Node` attribute.

modules/javafx.graphics/src/main/java/javafx/scene/AccessibleRole.java line 836:

> 834:      * </ul>
> 835:      */
> 836:     DIALOG

You need to add a `@since 20` tag.

-------------

Changes requested by kcr (Lead).

PR: https://git.openjdk.org/jfx/pull/873


More information about the openjfx-dev mailing list