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

Javafx TextField positions the cursor incorrectly after pressing DEL key

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      I have a Windows 10 machine.
      I could reproduce it in Java 8, Java 11, Java 14, and Java 15

      A DESCRIPTION OF THE PROBLEM :
      If use your mouse to click on the TextField to position the cursor right before a character, then if you press DEL key to delete the said character, you will notice that the cursor will be shifted one character to the left instead staying put.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the following sample code.
      2. Use your mouse to click on the exact spot between 'a' and 'b' characters. This will put the cursor right after 'a'.
      3. Press the DELETE key in your keyboard.

      Note: You have to use your mouse to click on 'b' to move the cursor there. If you use your keyboard arrow keys to move the cursor there then this bug won't happen.

      Also make sure to press DELETE key, not the BACKSPACE key.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Character `b` should be deleted and the cursor should not move (remain at AFTER `a` character).
      ACTUAL -
      Character `b` is deleted but the cursor moves to left. It will end up at BEFOR the `a` character.

      ---------- BEGIN SOURCE ----------
      TextField text1 = new TextField("abc");
      TextField text2 = new TextField("abc");
      HBox root = new HBox(text1, text2);
      Scene scene = new Scene(root, 800, 600);
      stage.setScene(scene);
      stage.show();
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          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: