JDK-8130893 : Focus does not navigate to the second radio button when added to Button Group
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.accessibility
  • Affected Version: 8u45,9
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_2008
  • CPU: x86
  • Submitted: 2015-07-09
  • Updated: 2016-06-02
  • Resolved: 2016-06-02
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 9
9Resolved
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows Server 2008 R2 Enterprise
64 bit Operating System

A DESCRIPTION OF THE PROBLEM :
This issue is seen only with jre8u45.The issue is on the traversal of focus.

When we have a bunch of radio buttons added to a button group focus does not navigate to second radio button on hitting a tab

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1)Just write a Simple Java Program with multiple radio buttons and run the same when he hit tab button,the focus does not navigate to second radio button

This was working perfectly fine with jre7,issue seen only in jre8u45

Simple Java Program:

import java.awt.FlowLayout;
 
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.SwingUtilities;
 
public class SwingJRadioButtonDemo extends JFrame {
 
    public SwingJRadioButtonDemo() {
        super("Swing JRadioButton Demo");
 
        JRadioButton option1 = new JRadioButton("Linux");
        JRadioButton option2 = new JRadioButton("Windows");
        JRadioButton option3 = new JRadioButton("Macintosh");
 
        ButtonGroup group = new ButtonGroup();
        group.add(option1);
        group.add(option2);
        group.add(option3);
 
        setLayout(new FlowLayout());
 
        add(option1);
        add(option2);
        add(option3);
 
        pack();
    }
 
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
 
            @Override
            public void run() {
                new SwingJRadioButtonDemo().setVisible(true);
            }
        });
    }
}

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
On pressing the tab button Focus should ideally navigate from 1st radio button to second and so forth
ACTUAL -
Currently on pressing tab focus is only on first radio button,focus does not move on pressing tab,one has to use arrow keys to navigate.

Pressing Tab works perfectly fine with other component like JCheckBox,issue is seen only with JRadioButton

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.FlowLayout;
 

import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.SwingUtilities;
 
public class SwingJRadioButtonDemo extends JFrame {
 
    public SwingJRadioButtonDemo() {
        super("Swing JRadioButton Demo");
 
        JRadioButton option1 = new JRadioButton("Linux");
        JRadioButton option2 = new JRadioButton("Windows");
        JRadioButton option3 = new JRadioButton("Macintosh");
        JCheckBox option4 = new JCheckBox("Macintosh");
        JCheckBox option5 = new JCheckBox("Windows");
        ButtonGroup group = new ButtonGroup();
        group.add(option1);
        group.add(option2);
        group.add(option3);
        group.add(option4);
        group.add(option5);
 
        setLayout(new FlowLayout());
 
        add(option1);
        add(option2);
        add(option3);
        add(option4);
        add(option5);
 
        pack();
    }
 
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
 
            @Override
            public void run() {
                new SwingJRadioButtonDemo().setVisible(true);
            }
        });
    }
}
---------- END SOURCE ----------


Comments
See JDK-8033699.
10-07-2015

There was a long standing bug in Java where when focus was on a button in a button group hitting tab would move the focus to the next radio button. This is incorrect behavior; focus should move out of the button group. Proper UIX is that the arrow keys should be used to move to the next button in the same button group. This bug has been recently fixed.
10-07-2015

1. Run the attached test case (SwingJRadioButtonDemo) in Windows 7 (64-bit). 2. Checked this for JDK 8, 8u31, 8u45, 8u60 ea b21, and 9 ea b71. 8: OK 8u31: OK 8u40: FAIL 8u60 ea b21: FAIL 9 ea b71: FAIL Result: This issue is reproducible with JDK 8u40 and onwards including 9 ea b71. This looks like a duplicate of JDK-8129940 with fix for 9. Though JDK 9 ea b71 still reproduce this issue.
10-07-2015