RFR: 8283214: [macos] Screen magnifier does not show the magnified text for JcomboBox [v8]
Alexey Ivanov
aivanov at openjdk.org
Thu Nov 2 18:19:18 UTC 2023
On Tue, 26 Sep 2023 11:12:08 GMT, Abhishek Kumar <abhiscxk at openjdk.org> 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
>
> - AccessibleName set in Listener
> - Master
> - Revert BasicComboBoxUI fix and update review comment
> - bugid removed in comments
> - Add condition to check JLabel instance
> - set accessiblename to displayed text in JComboBox
> - Merge
> - Explicit frame dispose remove
> - merge
> - Review comment update
> - ... and 1 more: https://git.openjdk.org/jdk/compare/4b9a198e...1a48076b
This is definitely an improvement compared to the complete lack of magnified text on hover, but it still doesn't handle custom renderers.
I've been digging into how this works in Metal but I couldn't figure it out completely. Eventually, it gets to `JList` of the popup, the list returns the renderer component as its child at the specified position — this is how text from the renderer gets used as the accessible name.
This should work for Aqua L&F too, all UI classes are derived from `BasicUI`, but for whatever reason it doesn't, and I didn't figure it out unfortunately.
However, I came up with an alternative solution which handles custom renderers nicely. You can find my version at [commit eee17ca](https://github.com/openjdk/jdk/commit/eee17ca7fc07fb87997040589bde83f5fad9fdea), it shows the changes to your latest version in the PR. You can also view [the diff to jdk/master](https://github.com/openjdk/jdk/compare/master...aivanov-jdk:jdk:eee17ca7fc07fb87997040589bde83f5fad9fdea).
Ideally, I'd like to make Aqua L&F classes work like Metal or Nimbus do. I spent quite a lot of time, and it requires even more time to understand how it gets to `JList.AccessibleJList` and `AccessibleJListChild`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14497#issuecomment-1791291765
More information about the client-libs-dev
mailing list