VoiceOver Reads Button Incorrectly

XMLWordPrintable

    • os_x

      When VoiceOver iterates through the UI, it can read buttons incorrectly.

      Steps to reproduce:
      1. Open the demo program below
      2. Turn on VoiceOver
      3. Position the VoiceOver cursor on the leftmost button (a JCheckBox)
      4. Press CTRL + ALT + RIGHT to move the VoiceOver cursor to the next component (a JButton)

      Observe the VoiceOver cursor moves as expected, but it reads the name and state of the checkbox that it is no longer highlighting.

      The expected behavior is to read the name and state of the button it is now highlighting.

      If you press CTRL + ALT + F3 then VoiceOver reads the button info correctly.

      Limited testing suggests I may be able to work-around this by setting the button's accessibility description to an empty string.

      ```
      import javax.swing.*;
      import java.awt.*;

      public class M {
          public static void main(String[] args) {
              JFrame f = new JFrame();

              f.getContentPane().setLayout(new FlowLayout());

              AbstractButton button1 = new JCheckBox("chess");
              AbstractButton button2 = new JButton("backgammon");

              // adding an empty ax desc may (?) help resolve the problem:
      // button2.getAccessibleContext().setAccessibleDescription("");

              f.getContentPane().add(button1);
              f.getContentPane().add(button2);
              f.pack();
              f.setVisible(true);
          }
      }
      ```

            Assignee:
            Unassigned
            Reporter:
            Jeremy Wood
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: