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

Abhishek Kumar abhiscxk at openjdk.org
Wed Jul 5 09:46:13 UTC 2023


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

>>> But in case of JComboBox, a11y API invokes the `getAccessibleName` method for `AccessibleJButton` and that returns an empty string.
>> 
>> 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.
>> 
>> Does this work with editable combo box?
>
>> 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.

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

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



More information about the client-libs-dev mailing list