Search Issue Tracker
By Design
Votes
0
Found in
2019.1.0a12
2019.1.0b2
2019.2.0a1
Issue ID
1126687
Regression
Yes
Text in a TextField does not get selected when calling TextField.Focus and TextField.SelectAll
How to reproduce:
1. Open attached project ("TextFieldBug.zip")
2. Go to Window > TextField BUG to open TestEditorWindow
3. Press button number 1
Expected result: Text appears and gets selected
Actual result: Text appears but does not get selected
Reproducible with: 2019.1.0a12, 2019.1.0b2, 2019.2.0a5
Not reproducible with:
2019.1.0a7 and earlier (errors because of the missing elements),
2019.1.0a8, 2019.1.0a9 (worked fine)
Notes:
2019.1.0a10-2019.1.0a11 SelectAll works, but only the second time you use it, after making the text visible.
Workaround:
You need to use these 3 lines in addition to Focus and SelectAll:
var textInput = m_TextField.Q("unity-text-input");
m_TextField.delegatesFocus = true;
textInput.visible = true;
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Remove option is not available when multi selecting custom packages
- Volumetric Clouds close to the horizon flicker when "Ghosting Reduction" is enabled
- Temporary dark areas appear when quickly dragging Editor window splitters while using "Direct3D 12" graphics API and "Light" Editor theme
- Focus changes from the IDE to the Unity Editor when compiling code in the IDE
- A glare from the Light Placement Tool is visible when the Main Camera is set to "Perspective"
Resolution Note:
We only need this line:
m_TextField.Q("unity-text-input").visible = true;
before trying to focus the field.
The reason why m_TextField.visible = true is not sufficient is that as of today, visibility is a hierarchical concept. We need a styling pass for the visible attribute to propagate to the children.