On Sat, 14 Feb 2026 23:47:10 GMT, Jeremy Wood <[email protected]> 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...
I really do not like this idea because a) It might affect other platforms and
we have two other platforms to worry about - Windows with JAWS and NVDA that we
support and Linux which we do not officially support but there are unofficial
ports of accessbridge that allows Java applications to be accessible with Gnome
based UI and while we do not support it we do not want to intentionally break
it either; and b) It might not work correctly with other locales - we can not
tell for sure until we test.
Bottom line - fixing platform specific issue in the shared code requires
testing on all affected platforms and changing localization without testing it
with at least 3-4 most commonly used locales is also questionable.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29727#issuecomment-3926136693