> A JButton's `AccessibleAction#getAccessibleActionDescription()` is localized.
>
> For example: in German it returns "clicken", and in English it returns
> "click".
>
> In JavaAccessibilityActions.m we have this method:
>
> void initializeActions() {
> int actionsCount = 5;
>
> sActions = [[NSMutableDictionary alloc] initWithCapacity:actionsCount];
>
> [sActions setObject:NSAccessibilityPressAction forKey:@"click"];
> [sActions setObject:NSAccessibilityIncrementAction forKey:@"increment"];
> [sActions setObject:NSAccessibilityDecrementAction forKey:@"decrement"];
> [sActions setObject:NSAccessibilityShowMenuAction forKey:@"toggle popup"];
> [sActions setObject:NSAccessibilityPressAction forKey:@"toggleexpand"];
> ...
>
>
> This sets up a mapping based on the constant fields in
> `javax.accessibility.AccessibleAction`.
>
> But this mapping doesn't help if the String we interface with is translated.
> (This test focuses on German, but this principle applies to any non-English
> localization.)
>
> For the most part this won't seriously affect German users, because VoiceOver
> has a fallback: if you ask to "click" a button that doesn't have a
> NSAccessibilityPressAction, then VoiceOver will temporarily move the mouse
> over the button, click it, and then restore the mouse.
>
> This PR modifies CommonComponentAccessibility.m so it defines a
> NSAccessibilityPressAction, so VoiceOver doesn't have to move the mouse to
> activate buttons. This is based on the observation that VoiceOver is willing
> to try pressing the component anyway (with a simulated mouse click),
> therefore it should be safe (or at least "equally dangerous") to offer a
> NSAccessibilityPressAction instead.
>
> If this is considered too generic / risky we could instead:
> A. Limit this new logic to components with AccessibleRoles that act as
> buttons or
> B. De-localize this text in CAccessibility. For ex: `if (axActionDesc ==
> UIManager.getString("AbstractButton.clickText") return "click"`
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
Jeremy Wood has updated the pull request with a new target base due to a merge
or a rebase. The incremental webrev excludes the unrelated changes brought in
by the merge/rebase. The pull request contains three additional commits since
the last revision:
- Merge remote-tracking branch 'origin/master' into 8377938
- 8377938: remove " (Mac-only)"
This is in response to:
https://github.com/openjdk/jdk/pull/30181#discussion_r2984313760
- 8377938: use NSAccessibilityPressAction for only action
If we asked VoiceOver to "click" a button that doesn't have
NSAccessibilityPressAction defined: it would temporarily move the mouse,
simulate a mouse click, and then restore the mouse position.
Instead: with this commit we've given it a clear NSAccessibilityPressAction,
so it will trigger the AccessibleAction and not move the mouse.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/30181/files
- new: https://git.openjdk.org/jdk/pull/30181/files/4baaf31a..2ab259dc
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=30181&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=30181&range=01-02
Stats: 193037 lines in 3571 files changed: 77394 ins; 86817 del; 28826 mod
Patch: https://git.openjdk.org/jdk/pull/30181.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/30181/head:pull/30181
PR: https://git.openjdk.org/jdk/pull/30181