RFR: 8271846 a11y API lacks setSelectedIndex method [v4]

Sergey Bylokhov serb at openjdk.org
Wed Nov 23 02:31:44 UTC 2022


On Wed, 23 Nov 2022 02:16:31 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> I tried calling clearSelection again instead of adding an interface:
>> 
>>                 if (as == null) return;
>>                 if (pac.getAccessibleRole().equals(AccessibleRole.LIST)) {
>>                     as.clearAccessibleSelection();
>>                 }
>>                 as.addAccessibleSelection(i);
>> 
>> After that I changed the call to ```javax.swing.JList.AccessibleJList#addAccessibleSelection```
>> 
>> JList.this.addSelectionInterval(i, i);
>> 
>> on the
>> 
>> JList.this.getSelectionModel().setSelectionInterval(i, i);
>> 
>> Nothing changed. VoiceOVer still freezes.
>> I think that the problem is not that setting the selection doesn't work, but that clearing the selection before setting causes the VO to fris.
>
> Some probably related points, the implementation of the addAccessibleSelection for the JComboBox. is the same:
> 
>             clearAccessibleSelection();
>             JComboBox.this.setSelectedIndex(i);
> 
> 
> It is possible that it also hangs?

>I think that the problem is not that setting the selection doesn't work, but that clearing the selection before setting causes the VO to fris.

Are you sure that the selection should be always cleared in this method, how it will work if the jlist supports multiline selection? Or voice over does not support multyline selection?

As a fix, you can delete listeners from the jlist so your request to clear the current selection will not be sent back to the voiceover. Or you can add a new method to the AccessibleSelection interface with the default implementation "clearAccessibleSelection+addAccessibleSelection". Then override it in the jlist to call setSelectedIndex().

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

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



More information about the client-libs-dev mailing list