On Thu, 9 Apr 2026 05:40:14 GMT, Jeremy Wood <[email protected]> wrote:

> With this PR:
> We call `CAccessible.valueChanged` when we believe the value changed, not 
> when the AccessibleStateSet changed.
> 
> Although this is a small refactor: it touches parts of code that span 
> approximately a decade of different bug fixes. At least one of these older 
> bugs was a P2. I tried to note the related issues in the test for reference. 
> (Also in my testing I confirmed JRadioButtons and JToggleButtons work as 
> expected, but I kept the final test simple for the convenience of human 
> testers.)
> 
> In 8377936 the problem was:
> 
> We had two components, X and Y. When VO transferred the focus from X to Y, it 
> would (ever so briefly) start to announce Y.** Then Swing would update X's 
> AccessibleContext to inform it that X was no longer focused, therefore X's 
> AccessibleStateSet changed. This triggered CAccessible's AXChangeNotifier, 
> which called `CAccessible.valueChanged`. This resulted in VoiceOver 
> announcing X's state (as if it thought the selected state changed), even 
> though the keyboard focus was now on Y.
> 
> The AXChangeNotifier was probably intending to call `valueChanged` only when 
> AccessibleState.SELECTED or CHECKED or something important was updated. The 
> fact that it called `valueChanged` for AccessibleState.FOCUSED is probably an 
> oversight***.
> 
> ** If you comment out the line in CAccessibility.requestFocus that actually 
> requests the focus: then VoiceOver announced Y correctly. But this left the 
> keyboard focus on the wrong component.
> 
> *** I also tested triggering AccessibleState.FOCUSABLE, 
> AccessibleState.VISIBLE, and a few other states; none of them resulted in a 
> comparable bug, though.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

@mickleness 
Your change (at version 0ad8688bbdccc5308b525cb123c04bb2aead23d5) is now ready 
to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk/pull/30641#issuecomment-4264959237

Reply via email to