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

[Accessibility] SHOW_MENU action should be handled in Node

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u40
    • 8u20
    • javafx
    • None

      Currently the code in Control handles the accessibility SHOW_MENU action, enabling controls to display their context menus when a user invokes a special accessibility shortcut (e.g. Ctrl+NumPad5 on Mac).
      However, FX API allows any Node to add a context menu event handler and process it whenever the event occurs. Thus, any instance of the Node class may display the context menu. To make all nodes accessible, the SHOW_MENU handler should be moved from Control to Node. E.g., the code in Node could look like:

          public void accExecuteAction(Action action, Object... parameters) {
              if (Action.SHOW_MENU.equals(action)) {
                  Bounds b = getBoundsInLocal();
                  Point2D pt = localToScreen(b.getMaxX(), b.getMaxY());

                  ContextMenuEvent context = new ContextMenuEvent(ContextMenuEvent.CONTEXT_MENU_REQUESTED,
                          b.getMaxX(), b.getMaxY(), pt.getX(), pt.getY(), false, new PickResult(this, b.getMaxX(), b.getMaxY()));
                  Event.fireEvent(this, context);
              }
          }

      (perhaps with some adjustments to the way the coordinates and the PickResult are constructed...)

            fheidric Felipe Heidrich (Inactive)
            anthony Anthony Petrov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: