RFR: 8271846 a11y API lacks setSelectedIndex method [v2]

Artem Semenov asemenov at openjdk.org
Tue Nov 8 08:49:36 UTC 2022


On Mon, 7 Nov 2022 21:20:45 GMT, Phil Race <prr at openjdk.org> wrote:

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

@prrace
I acknowledge that this change is not portable.

The absence of the dedicated AccessibleList interface does not allow setting selections on lists on MacOS using the accessible shortcuts and external accessibility devices. The current solution severely limits the ability of accessibility subsystem to interact with the list component thus it is not acceptable. Existing implementation uses AccessibleSelection implemented in the JList but it lacks ability to work with multiple selection intervals and side effects of setting singular selection with sequential calling of clearSelection() and addSelection() lead to the the line selection action being repeated by the VoiceOver indefinitely.

We need a new accessibility interface that will implement the selection model for accessibility lists. Also it should provide additional information about the list, regardless of whether the accessibility list is inherited from JList or impolemented from scratch. New interface should be able to provide system with the additional information such as selection mode and should be flexible enough to allow implementation of both single and multiselection modes. The AccessibleSelection interface does not allow working with index intervals, which will prevent the implementation of multiple selection in the future.
This interface is not yet relevant on windows because the most common readers do not have a screen navigation modes similar to VoiceOver quick navigation and the current functionality is sufficient.

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

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



More information about the client-libs-dev mailing list