RFR: 8377938: VoiceOver Uses Mouse to Activate JButtons in German
Alexander Zuev
kizune at openjdk.org
Fri Feb 20 22:26:57 UTC 2026
On Sat, 14 Feb 2026 23:47:10 GMT, Jeremy Wood <jwood at openjdk.org> wrote:
> Previously:
> The action description would be localized text. So in German's case `getAccessibleActionDescription(0)` would return `Klicken`. As that String is passed upwards towards VoiceOver, we're counting on VoiceOver's code interpreting it correctly.
>
> With this PR:
> We always return "click" (using the AccessibleAction.CLICK constant). VoiceOver knows how to interpret an unlocalized "click".
>
> ## Context
>
> I looked up references to other AccessibleAction constants:
>
> - AccessibleAction.TOGGLE_EXPAND is referenced in JTree.java's `getAccessibleActionDescription` method.
> - AccessibleAction.INCREMENT and AccessibleAction.DECREMENT are referenced in JSlider's and JSpinner's `getAccessibleActionDescription` method.
> - AccessibleAction.CLICK and AccessibleAction.TOGGLE_POPUP are NOT currently referenced (prior to this PR)
>
> The javadoc for `getAccessibleActionDescription` simply describes the return value as "a String description of the action". It makes no comment on whether it should be localized or not.
>
> JList.java is similar to AbstractButton:
>
> public String getAccessibleActionDescription(int i) {
> if (i == 0) {
> return UIManager.getString("AbstractButton.clickText");
> } else {
> return null;
> }
> }
>
>
> JComboBox.java includes:
>
> public String getAccessibleActionDescription(int i) {
> if (i == 0) {
> return UIManager.getString("ComboBox.togglePopupText");
> }
> else {
> return null;
> }
> }
>
>
> I'd argue that we need to be consistent: either JTree/JSlider/JSpinner should be modified to return a localized action description, OR AbstractButton/JList/JComboBox should be modified to return the unlocalized constant.
>
> My preference is to modify AbstractButton and JList (as shown in this PR). (And I'd recommend addressing JComboBox in a separate PR.)
>
> (Also, I really like JTextComponent.java's implementation that combined Swing's ActionMap with AccessibleActions:
>
> public String getAccessibleActionDescription(int i) {
> Action [] actions = JTextComponent.this.getActions();
> if (i < 0 || i >= actions.length) {
> return null;
> }
> return (String)actions[i].getValue(Action.NAME);
> }
>
> ... but that's straying pretty far from the original ticket.)
>
> ## Non-Swing Context
>
> I also searched for `getAccessibleActionDescription` in general.
>
> In Button.java and MenuItem.java we have:
>
> public String getAccessibleActionDescription(int i) {
> if (i == 0) {
> // [[[PENDING: WDW -- need to provide a localized string]]]
> retur...
Well, first is to understand why VO does not trigger the correct action directly. VO does not invoke the Java accessibility API directly, instead it calls to the button's native accessibility peer and if that does not work we need to understand why - probably the platform specific code needs to be updated.
As for the consistency - i think the description has to be localized for all the components. Not sure why it does not.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29727#issuecomment-3937439049
More information about the client-libs-dev
mailing list