Search Issue Tracker

Fixed in 2020.2.X

Fixed in 2020.1.X

Votes

7

Found in

2019.1

2019.2

2019.3

2019.3.0f1

2020.1

Issue ID

1206181

Regression

No

UIElements TextField is not focused and you are not able to type in characters when using Focus() method

UI Toolkit

-

How to reproduce:
1. Open the attached 'project-1206181.zip' project
2. In the Editor select 'Bug' > 'Bug'
3. Try to type in any characters

Expected result: the text field is focused, you are able to type in characters
Actual result: the text field is NOT focused, you are NOT able to type in characters

Reproducible with: 2019.1.0a8, 2019.1.14f1, 2019.2.17f1, 2019.3.0f4, 2020.1.0a17
Could not test with: 2019.1.0a7 and earlier (Due to script errors)

Workaround for the issue: instead of using textField.Focus() use textField.Q("unity-text-input").Focus()

  1. Response avatar

    Resolution Note (fix version 2020.2):

    Fixed in 2021.1.0a2

  2. Response avatar

    Resolution Note (fix version 2020.2):

    Fixed in 2020.2.4f1

Comments (2)

  1. 67ec32353cd5f2a27ac7c9b4ce39d786?d=mm

    icepower2012

    Sep 10, 2020 08:04

    try this:
    textField[0].Focus();

  2. B0e37b1e343eae3117671688ea77f170?d=mm

    Illumina33

    Mar 18, 2020 17:42

    This is also occurring for us. The only workaround that has worked for me so far is to synthesize MouseDown and MouseUp events onto the field.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.