On Wed, 28 May 2025 02:28:40 GMT, Abhishek Kumar <[email protected]> wrote:
>> VoiceOver announce incorrect number of child for a submenu of JPopupMenu
>> when it is visible for the first time only. After that VO is able to
>> announce the number of items correctly.
>>
>> Issue: Problem is with the a11y subsystem method call to get the accessible
>> children details.
>>
>> Analysis: When the Submenu of a JPopupMenu is opened, accessible component
>> of PopupMenu is created dynamically in the native side implementation and
>> `PostMenuOpened` notification is sent to the a11y subsystem for the newly
>> created PopupMenu. Once the notification is sent to a11y sub-system, it
>> invokes the `accessibilityChildren` method to get the children details for
>> the menu component. A11y subsystem always retrieve the information of the
>> root level PopupMenu irrespective of the submenu's PopupMenu (PopupMenu is
>> associated with each JMenu) and thus announce the root level PopupMenu child
>> count which is incorrect.
>>
>> Proposed Fix: Proposed fix is to ensure the correct child details are sent
>> back to a11y sub-system for correct announcement. So, whenever the
>> `accessibilityChildren` method is invoked, first try to find out the current
>> accessible PopupMenu which is opened for the Submenu and then return the
>> child details.
>>
>> Testing : Manual test case is attached to verify the fix and there is no
>> failure with fix in CI pipeline.
>>
>> `Current fix also ensures the correct child counts are announced for the
>> JMenu's Submenu which are present in the JMenubar.`
>>
>> **Note :** While verifying the fix, a new issue is unearthed for multi-level
>> submenu where VO is failed to announce the Submenu's text. Since the issue
>> exists without the proposed fix too, it shall be treated as a new bug
>> finding and will raise a separate JBS issue.
>
> Abhishek Kumar has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Minor update
src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java line 877:
> 875: if (ac != null) {
> 876: Accessible aComp = null;
> 877: for (int i = 0; i < ac.getAccessibleChildrenCount(); i++) {
I suggest replacing for with while. If the desired submenu is at the beginning
of the list, there’s no need to traverse it further.
src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/MenuAccessibility.m line
65:
> 63: GET_CACCESSIBILITY_CLASS_RETURN(nil);
> 64: DECLARE_STATIC_METHOD_RETURN(sjm_getCurrentAccessiblePopupMenu,
> sjc_CAccessibility,
> 65: "getCurrentAccessiblePopupMenu",
Won’t it be possible to get the correct object like this, as it’s done in
```outlineRowAccessibility.m```?
jobject currentAccessible = [self currentAccessibleWithENV:env];
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25470#discussion_r2112139362
PR Review Comment: https://git.openjdk.org/jdk/pull/25470#discussion_r2112188590