RFR: 8283214: [macos] Screen magnifier does not show the magnified text for JcomboBox [v4]

Alexey Ivanov aivanov at openjdk.org
Wed Jul 5 12:39:59 UTC 2023


On Wed, 5 Jul 2023 09:43:12 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>>> And this seems to be the problem. The getAccessibleName method should be on JComboBox, or its editor, which should return the result of getAccessibleName of the renderer component.
>> 
>> Since the a11y APIs are called upon the `AquaComboBoxButton` (subclass of JButton) instance, need to set the text of the button to current displayed text of JComboBox. JComboBox contains `getAccessibleName` method but it is not invoked.
>> 
>>> Does this work with editable combo box?
>> 
>> Yeah, it worked for editable JComboBox. For editable JComboBox, the string is returned by NavigableTextAccessibility and it returns the current text displayed in editor.
>
> Accessible name is set by getting the current text displayed in JComboBox (using `renderer getText()` method) in stead of setting it by JComboBox  `getSelectedItem().toString() `method. Tested with custom renderer and it shows the magnified text as displayed in JComboBox.

> > And this seems to be the problem. The getAccessibleName method should be on JComboBox, or its editor, which should return the result of getAccessibleName of the renderer component.
> 
> Since the a11y APIs are called upon the `AquaComboBoxButton` (subclass of JButton) instance, need to set the text of the button to current displayed text of JComboBox. JComboBox contains `getAccessibleName` method but it is not invoked.

This is weird. I expect the accessibility API is called on the `JComboBox` in both cases where it's editable or not. Could this be a bug? Should we fix it in a different way?

> > Does this work with editable combo box?
> 
> Yeah, it worked for editable JComboBox. For editable JComboBox, the string is returned by NavigableTextAccessibility and it returns the current text displayed in editor.

That's good.

And it makes me wonder why non-editable combo box behaves so differently.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14497#discussion_r1253045504



More information about the client-libs-dev mailing list