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...

OK, thanks for the feedback. I was going to try to test Windows this weekend, 
but if this is DOA I can skip it.

More broadly:
A. Do you think the original ticket is a valid complaint that should remain 
open? (Or should it be closed as "won't fix"? or some other option?)

B. Do you agree with my assertion:
> 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.

This PR currently focuses on the second option. I could write up a new 
ticket/PR to explore the first option (localizing other action action 
descriptions)

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

PR Comment: https://git.openjdk.org/jdk/pull/29727#issuecomment-3928695623

Reply via email to