Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139194

CAccessible does not add listeners to some custom accessible components

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin macpro 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      The mac version does not add accessible listeners to custom AccessibleContexts that implement AccessibleEditableText and or AccessibleExtendedText, such that when things like selections change, the user is not notified. They are notified with a JTextComponent since the logic has:
          if (c instanceof JTextComponent) {
                  JTextComponent tc = (JTextComponent) c;
                  AXTextChangeNotifier listener = new AXTextChangeNotifier();
                  tc.getDocument().addDocumentListener(listener);
                  tc.addCaretListener(listener);
              }
      but it doesn't listen to custom ones.

      Note: the sample code routes the AccessibleContext that way because I don't want to have to write a dummy one my self for demonstration.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the panel in the sample code in a form. Select some text with the mouse

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Voice over speaks the selected text
      ACTUAL -
      Nothing happens

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class CustomAccessible extends javax.swing.JPanel {

      private final JScrollPane sneakyPane;
      private final JEditorPane innerPane;
      /**
      * Creates new form CustomAccessible
      */
      public CustomAccessible() {
      innerPane = new JEditorPane();
      innerPane.setText("The quick brown fox jumped over the lazy dog");
      sneakyPane = new JScrollPane(){
      @Override
      public AccessibleContext getAccessibleContext() {
      return null;
      }

      };
      sneakyPane.setViewportView(innerPane);
      initComponents();
      add(sneakyPane);
      }

      /**
      * This method is called from within the constructor to initialize the form.
      * WARNING: Do NOT modify this code. The content of this method is always
      * regenerated by the Form Editor.
      */
      @SuppressWarnings("unchecked")
          // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
          private void initComponents() {

              setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
          }// </editor-fold>//GEN-END:initComponents


          // Variables declaration - do not modify//GEN-BEGIN:variables
          // End of variables declaration//GEN-END:variables



      @Override
      public AccessibleContext getAccessibleContext() {
      return innerPane.getAccessibleContext();
      }

      private static class SneakyScrollArea extends JScrollPane{

      @Override
      public AccessibleContext getAccessibleContext() {
      return null;
      }

      }


      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is none.

            ptbrunet Pete Brunet (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: