On Sun, 8 Nov 2026 04:55:20 GMT, Alexander Zuev <[email protected]> wrote:

>> Querying native accessibility children from accessibilityIsIgnored can cause 
>> AppKit to walk up the ancestor hierarchy and query the same window’s ignored 
>> status again, resulting in infinite recursion that causes a 
>> StackOverflowError. The error may go unnoticed during normal execution 
>> because the native code clears pending Java exceptions, while an exception 
>> breakpoint in a debug session exposes the StackOverflowError before it is 
>> cleared.
>> 
>> The fix introduces a Java method that traverses the JavaFX accessibility 
>> children directly and reports whether the hierarchy contains context-menu or 
>> tooltip content. The native peer uses this result to determine whether the 
>> window should be ignored, without requesting native unignored children.
>> 
>> The original child query also initialized descendant accessibility peers so 
>> that VoiceOver could discover the menu content. The replacement preserves 
>> this behavior by initializing every peer encountered during traversal and 
>> continuing through all descendants even after finding a matching role.
>> 
>> 
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Alexander Zuev has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   trigger GitHub Actions

Note: I don't own a mac (and therefore also not familiar with the macOS code), 
so I just checked the code (and concept). 

I may have an idea to improve the code, otherwise I don't see a problem (better 
than the previous `AXJFXTOOLTIP` check).

modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacAccessible.java 
line 888:

> 886:                 continue;
> 887:             }
> 888:             accessible.getNativeAccessible();

Is this needed? Looks weird as a standalone code snippet. Might ne a comment 
that explain that this has an intended side effect we need?

modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacAccessible.java 
line 905:

> 903:                     }
> 904:                 }
> 905:             }

here, we have an `if` inside a `for` inside a `if` inside a `while`.
Code is not overly complex, but I wonder if we may want to extract this call to 
something like `pushPendingChildren` to make it easier to read and reduce 
complexity.

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

PR Review: https://git.openjdk.org/jfx/pull/2360#pullrequestreview-5830961363
PR Review Comment: https://git.openjdk.org/jfx/pull/2360#discussion_r4516663351
PR Review Comment: https://git.openjdk.org/jfx/pull/2360#discussion_r4516637506

Reply via email to