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

Accelerator of ContextMenu's MenuItem is not removed when ContextMenu is removed from Scene

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Backports

        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:
                arapte Ambarish Rapte
                Reporter:
                aghaisas Ajit Ghaisas
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: