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

MenuItems of a ContextMenu are reachable using Accelerators even after removing ContextMenu from the Scene

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: openjfx14
    • Fix Version/s: openjfx16
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      This was found while working on JDK-8175358 as a review comment in PR - https://github.com/openjdk/jfx/pull/199.

      It can be easily reproduced by either modifying test JDK-8175358 in to use a ContextMenu or running following JunitTest (to be added in AcceleratorParameterizedTest.java)

      @Test public void testAcceleratorIsNotFiredWhenMenuItemRemovedFromScene() {
              KeyEventFirer kb = new KeyEventFirer(item1, scene);

              kb.doKeyPress(KeyCode.DIGIT1, KeyModifier.ALT);
              assertEquals(1, eventCounter);

              // Remove all children from the scene
              Group root = (Group)scene.getRoot();
              root.getChildren().clear();

              kb.doKeyPress(KeyCode.DIGIT1, KeyModifier.ALT);
              assertEquals(1, eventCounter);
          }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                aghaisas Ajit Ghaisas
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: