JDK-8249548 : backward focus traversal gets stuck in button group
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.accessibility
  • Affected Version: 14,15,16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86
  • Submitted: 2020-07-15
  • Updated: 2024-11-20
  • Resolved: 2020-08-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 16 JDK 7 JDK 8
11.0.13Fixed 16 b14Fixed 7u331Fixed 8u321Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
If focus traversal to buttons is enabled (using Full Keyboard Access on macOS), then a backwards traversal (shift-TAB) can get stuck at a JToggleButton in a button group.

To demonstrate using the attached test program:
When started, the first text field should be focused.
Type TAB to transfer focus to the second button.
Type TAB to transfer focus to the last text field.
Type Shift-TAB to transfer focus to the second button.
Type Shift-TAB.
At this point, the focus should be transferred to the first text field, but instead it remains at the second button.
Comments
[11u backport] JDK-8255790 has been integrated, now new test passes. Restore fix-request tag.
24-08-2021

[~clanger] Sure, dropped fix-request tag for now.
09-08-2021

OK, I see. Maybe defer the backport until the situation for JDK-8255790 and JDK-8247872 is clear then? After all it's just Oracle 11.0.14 at the moment...
06-08-2021

[~clanger] JDK-8255790 has dependency on JDK-8247872, [~mdoerr] is working on that.
06-08-2021

[~zgu] can't you then backport JDK-8255790 first? It's anyway missing for Oracle parity...
05-08-2021

Fix Request (11u) A clean backport for parity with Oracle 11.0.14. New test crashes, followup backport of JDK-8255790 should fix the crash.
05-08-2021

11u backport: A clean backport to 11u. However, new test crashes on Fedora 34 (but not on Ubuntu 18.04.3 LTS) The crash probably is unrelated to this change, as it has been reported here [1] and the test also crash w/o this patch. New test provides a reliable reproducer. Note: the test passes with jdk/jdk Filed JDK-8272043 to track this crash [1] https://youtrack.jetbrains.com/issue/JBR-3066
05-08-2021

URL: https://hg.openjdk.java.net/jdk/jdk/rev/8f5405f6b528 User: psadhukhan Date: 2020-09-02 06:28:14 +0000
02-09-2020

URL: https://hg.openjdk.java.net/jdk/client/rev/8f5405f6b528 User: pbansal Date: 2020-08-31 10:30:38 +0000
31-08-2020

This issue is present in Nimbus L&F also. There it is present in both JToggleButton and JRadioButton.
24-07-2020

I have discussed this issue and yes, this is an issue. The JToggleButton behaviour should be similar to JRadioButton.
23-07-2020

I searched for ButtonGroup in the JDK and the first item I found was SynthFileChooserUIImpl, which puts JToggleButtons in a ButtonGroup. Aqua LAF also supports using JToggleButtons to create a simulated segmented control, and a ButtonGroup to simulate the "select one" behavior.
23-07-2020

I think this should not be an issue as I am not sure if this is correct way to use JToggleButton. We should be using JRadioButton if we need to create ButtonGroups. JToggleButton is not meant to be used for this purpose. I will be back on this when I have confirmed this.
23-07-2020

I have looked into this issue. To begin with, this issue is not specific to MacOS or AquaL&F. This is reproducible in Ubuntu 20.04. This is not reproducible in RadioButton as BasicRadioButtonUI class has keyEvent handler which changes the base component for while looking Next or Previous components to shift focus. This code is missing in JToggleButton. Hence the issue is seen in JToggleButton
22-07-2020

I believe this bug is related to some special case code in LayoutFocusTraversalPolicy and JToggleButton.getGroupSelection. The code in LFTP redirects the focus change to the "first" button in the group. The group selection code redirects the focus change to the selected button. If the candidate button for the traversal is the first button, the second button instead receives focus because it is selected. This happens regardless of the focus traversal direction. If the second button is focused, the first button is the first candidate for a backwards traversal, and the above code redirects the focus change to the second button, thus the focus traversal has no effect. I do not see this bug if the buttons are radio buttons, because of special code added to AquaButtonRadioUI.
16-07-2020