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 in ScrollView - Click+Dragging TextField resetting parent ScrollView Position

Discussion in 'UI Toolkit' started by ldaughtry, Jul 23, 2022.

  1. ldaughtry

    ldaughtry

    Joined:
    Oct 30, 2012
    Posts:
    38
    I'm having a very frustrating issue with a complex data editor I'm working on. I'm working in Unity 2022.1.10f1 on Windows.

    TL;DR version:
    When I click drag to select text to edit in a TextField that is parented under a ScrollView, it is resetting that parent ScrollView to it's base position which is making editing basically impossible.​


    Detailed Version
    This is the editor (with content blurred because I can't share it):
    upload_2022-7-23_15-15-57.png
    The central column with the red outline is a dense data editing view. The entries are under a vertical ScrollView, with many sections also being foldouts to allow the data to be condensed visually.

    Many of the entries are TextField elements. Shown below you can see that the ScrollView is scrolled down (the green outlined section) and I have clicked into a TextView which selects all the text within which is currently highlighted blue.
    upload_2022-7-23_15-21-27.png

    If I instead click drag in the TextField, or click drag in any TextField under the root ScrollView at any time, it resets the root ScrollView to the base position as shown below:
    upload_2022-7-23_15-22-34.png
    The click drag is still active so I'm getting a text select in the TextField, but the interaction is ruined.

    Any thoughts here?


    Solutions Attempted
    I have attempted turning off selectAllOnFocus and selectAllOnMouseUp in the TextField with no improvement to the ScrollView behavior. I have attempted to brute force intercept the mouse events at the the TextView to see if stopping them would stop whatever is causing the ScrollView behavior, no luck there either.
     
    pawelduda likes this.
  2. ldaughtry

    ldaughtry

    Joined:
    Oct 30, 2012
    Posts:
    38
    Ok, as an update here, this behavior happens if I click+drag on top of any child that takes mouse input of the ScrollView. Button, TextField, FoldOut, anything.
     
    Last edited: Jul 24, 2022