On Fri, 10 Nov 2023 04:30:33 GMT, Abhishek Kumar <[email protected]> wrote:
>> The issue exist only for non-editable combobox and the root cause is
>> accessible object is not created due to incorrect index returned from
>> component class which results in no a11y API invoked.
>>
>> Proposed solution is to return the correct accessible child from
>> getAccessibleChild method which is AquaComboBoxButton (arrowButton) instance
>> and that results in invoking the a11y APIs to return the current selected
>> item in combobox.
>>
>> Further when the application comes up first time the accessible name is not
>> set for current displayed item in JCombobox that is handled in
>> AquaComboBoxButton which will take care for the current selected item as
>> well as if user modifies the selection by drop-down list.
>>
>> CI link is posted in JBS.
>
> Abhishek Kumar has updated the pull request incrementally with one additional
> commit since the last revision:
>
> jtreg update
Looks good to me.
Someone else should also approve it.
src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxButton.java line 276:
> 274: name = c.getAccessibleContext().getAccessibleName();
> 275: }
> 276: }
For the button, super usually returns `""` (empty string) which is the default
caption of the button. This code preserves the common behaviour of
`getAccessibleName`, in particular it returns `accessibleName` field if it's
set.
Since the arrow button is an internal component, we may drop calling `super`.
However, I'm unsure about it.
The two `if` statements could be combined into one:
if ((name == null || name.isEmpty())
&& (!comboBox.isEditable() && comboBox.getSelectedItem() !=
null)) {
-------------
Marked as reviewed by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14497#pullrequestreview-1724628970
PR Review Comment: https://git.openjdk.org/jdk/pull/14497#discussion_r1389305637