Search Issue Tracker
By Design
Votes
0
Found in [Package]
1.0.0-preview.14
Issue ID
1316122
Regression
No
[UI Toolkit] FocusEvent is never called when using RegisterCallback on UI Document rootVisualElement
How to reproduce:
1. Open the attached project's Scene labeled "SampleScene"
2. Enter the Play Mode
3. In the Game View, select a random Button
4. Select another Button
5. Inspect the Console Window
Expected result: FocusEvent is called when Button is pressed
Actual result: FocusEvent is not called
Reproducible with: 1.0.0-preview.14 (2020.2.7f1, 2021.1.0b9, 2021.2.0a3)
Couldn't test with: 2018.4.32f1, 2019.4.21f1 (UI Toolkit is not available), 2021.2.0a4, 2021.2.0a7 (Unresolvable internal package errors)
Note: Although FocusEvent is not called, FocusInEvent and FocusOutEvent are called
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
- Editor freezes after some time when using NavMeshQuery::Raycast
- Cube is rendered green when its color is set to black and using the Lift Gamma Gain Volume interpolation
- Inner and outer exceptions are not unrolled correctly
- [iOS][WebGL] Audio Clip doesn't play when Load Type is set to Decompress On Load and iOS Silent Mode is enabled
- Crash on EditorBuildSettings::GetConfigObject when closing a specific project
Resolution Note:
The FocusEvent type trickles down and does not bubble up, so you can only get it by adding a callback to the target element itself (in the provided example, the buttons); FocusInEvent and FocusDown both trickle down and bubble up, which is why the rootVisualElement gets a called for it in the provided example.
Documentation for the event types:
- https://docs.unity3d.com/ScriptReference/UIElements.FocusEvent.html
- https://docs.unity3d.com/ScriptReference/UIElements.FocusInEvent.html
- https://docs.unity3d.com/ScriptReference/UIElements.FocusOutEvent.html
For support with UI Toolkit we suggest coming to our Forum: https://forum.unity.com/forums/ui-toolkit.178/