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

Touch scrolling action give focus / action on controls where the movement start

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Tablet Microsoft Surface 3 / Windows 10 Pro 22H2 / OpenJDK 21.0.1 with JavaFX 21.

      A DESCRIPTION OF THE PROBLEM :
      On touch sensitive mode, every sliding movement that start from a control will give focus on that control even if the movement finish outside of the control. It can also execute some actions.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Simply start the simple provided code. Then:

      1. First just note that the focus is on the button
      2. Then slide with your finger to scroll:
      - if the slide start from the button, it will take the focus
      - if the slide start from the textfield, it will take the focus AND edit mode will start (the caret will be displayed)
      - if the slide start from the TitledPane header, it will take the focus AND expand/collapse
      - otherwise the scrollPane take the focus

      On sensitive mode, what happen on Textfield and the TitledPane is very annoying at usage when we just want to scroll. With text input control it will always display the virtual keyboard and we don't expend the TitledPane to collapse.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I tested on two others apps to check the optimal behavior: the IntelliJ settings and Windows Notepad.
      In this both apps, sliding is detected so only scroll happen. The controls are fired only when there are tapped.

      ---------- BEGIN SOURCE ----------
      package com.example.bugtouchevent;

      import javafx.application.Application;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.control.TextField;
      import javafx.scene.control.TitledPane;
      import javafx.scene.layout.VBox;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      public class HelloApplication extends Application {

          @Override
          public void start(Stage stage) {
              Button button = new Button("Hello!");
              TextField textField = new TextField();
              TitledPane titledPane = new TitledPane();
              titledPane.setContent(new Rectangle(50, 50, Color.BLUE));
              titledPane.setCollapsible(true);

              VBox vBox = new VBox(button, textField, titledPane);
              vBox.setAlignment(Pos.TOP_CENTER);
              vBox.setSpacing(20);
              vBox.setMinHeight(800);

              ScrollPane scrollPane = new ScrollPane(vBox);
              scrollPane.setFitToWidth(true);
              scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);

              Scene scene = new Scene(scrollPane, 640, 480);
              stage.setTitle("Hello!");
              stage.setScene(scene);
              stage.show();
          }

          public static void main(String[] args) {
              launch();
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: