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

Popup with ScrollPane makes TextField in main Stage some key events ignored

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u221, 9, openjfx11, openjfx12, openjfx13
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      A DESCRIPTION OF THE PROBLEM :
      I create Popup having ScrollPane with Buttons. Popup is show over Window having TextField. After Popup shown TextField key events of codes LEFT, RIGHT, HOME, END have no effect.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test application. Type in some text. Try to use left arrow, right arrow, home, end buttons.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Caret position changes.
      ACTUAL -
      Caret position does not change.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.geometry.Point2D;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.control.TextField;
      import javafx.scene.input.KeyEvent;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Popup;
      import javafx.stage.Stage;

      public class PopupApp extends Application {

          public static void main(String[] args) {
              launch(args);
          }
          
          @Override
          public void start(Stage stage) throws Exception {
              TextField textField = new TextField();
              StackPane stackPane = new StackPane(textField);
              
              stage.setScene(new Scene(stackPane));
              stage.show();
              
              ScrollPane scrollPane = new ScrollPane(new VBox(new Button("Option1"), new Button("Option2")));
              Popup popup = new Popup();
              popup.getContent().add(scrollPane);
              
              Point2D pinPoint = textField.localToScreen(0., textField.getHeight());
              popup.show(textField, pinPoint.getX(), pinPoint.getY());
              
              textField.addEventHandler(KeyEvent.KEY_RELEASED, event -> {
                  System.out.println("KEY_RELEASED " + event);
              });
              
              textField.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
                  System.out.println("KEY_PRESSED " + event);
              });
          }
      };
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: