RFR: 8271846 a11y API lacks setSelectedIndex method [v2]

Phil Race prr at openjdk.org
Mon Nov 7 21:24:30 UTC 2022


On Wed, 11 May 2022 12:49:34 GMT, Artem Semenov <asemenov at openjdk.org> wrote:

>> A11Y implementation on macOS has to directly call the 'JList.setSelectedIndex' method in order to request selection on an item (see 'CAccessibility.requestSelection'). The reason is that a11y API lacks appropriate method.There's only 'javax.accessibility.AccessibleSelection#addAccessibleSelection' which is mapped to 'javax.swing.JList#addSelectionInterval', it can not be used to set selected index.
>> 
>> @forantar @azuev-java @mrserb please review.
>> 
>> Please note that the new API allows you to implement a multiple selection in lists from the Java side, but I did not succeed in implementing it, because I could not determine the inclusion of the so-called "VoiceOver multiple selection mode".
>
> Artem Semenov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   We don't do @author tags in openjdk
>   Not 2022 ?

I am still waiting for the following questions (from July) to be answered here (not somewhere else)

> You did not acknowledge this is not a backportable fix

By which I mean, if this needs to be solved in say JDK 11 too, what will you do ??

> I'd like you to explain why calling setSelectedIndex isn't good enough AND why Windows A11Y does not need this API

Also leaving aside that you haven't yet shown the API is needed I note that there are javax.accessibility is NOT
the place for Component specific A11Y classes.
So adding javax.accessibility.AccessibleList looks like a very anomalous and perhaps incorrect design.

The similar examples are nested classes of the component, eg
JTree.AccessibleJTree
JTable.AccessibleJTable

In fact there's even already a JList.AccessibleJList !

And it seems to have things that look similar to things you say you need
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/JList.AccessibleJList.html#isAccessibleChildSelected(int)

and your API

+    boolean isSelectedIndex(int index);

===

and
public int getAccessibleSelectionCount()
Returns the number of items currently selected. If no items are selected, the return value will be 0.

===
and you have

+    /**
+     * Returns true if no indices are selected.
+     *
+     * @return {@code true} if no indices are selected.
+     */
+    boolean isSelectionEmpty();

etc etc ..

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

PR: https://git.openjdk.org/jdk/pull/8578



More information about the client-libs-dev mailing list