Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bug TextField text gets pushed to the left too early during input

Discussion in 'UI Toolkit' started by ckline, Nov 17, 2022.

  1. ckline

    ckline

    Joined:
    Apr 16, 2013
    Posts:
    3
    I have encountered this bug after upgrading to 2022.

    The expected behavior of the UI Toolkit TextField is that if the typed text exceeds the bounds of the TextField, it will expand to encompass all the text, until the maximum size of the TextField or its parent VisualElement is reached, at which point the text will begin to move to the left, with new text appearing at the rightmost bound of the TextField box.

    In 2022, the 'move to the left' part happens early, at the moment the TextField bounds are initially increased, and the cursor position is a character's width of space away from the rightmost bound. It looks like the entire text gets pushed to the left, obscuring the first character.

    In this gif, the value for "Max ET" is initially set to 100 via UI Builder. I click to change it and start typing. Initially, the "1" is visible but as more character appear and the box expands, all the characters are shifted to the left. They can be shifted to their correct positions using the arrow keys to move the cursor all the way to the front, and they cannot be shifted back to the left using the arrow keys. But once more characters are typed, they all shift.

    UIToolkit-TextField-Issue.gif

    I am using a WebGL build in Unity 2022.1.23f1. This bug happens in the editor window and when viewed on a PC. It does not happen on mobile using the touch keyboard.

    I have verified the bug using a brand new Unity project too.
     
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    443
    Hi @ckline, thanks a lot for bringing this up!

    I don't think this is a known issue. Can you log a bug ? See this page for instructions.
     
  3. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    443
    For more information regarding de changes to the TextField in 2022.1 have a look at this thread.
     
  4. ckline

    ckline

    Joined:
    Apr 16, 2013
    Posts:
    3
    Thanks. Bug report submitted.
     
    HugoBD-Unity likes this.