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
- Terms of Service agreement checkbox is invisible under specific OS system themes (UI Accessibility)
- Tile Palette: "Create New Tilemap" dropdown area is displayed in several colors
- Input.mousePosition stops syncing to touch input when using "DownloadHandlerTexture" in WebGL build
- UI Builder canvas doesn't update element styling accordingly when changing Active Theme for some Editor Authoring elements
- Selector Value buttons are not aligned with parameters in UI Builder
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/