Manual/UIE-faq-event-and-input-system #711
Replies: 2 comments
-
|
The GameObject containing the |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Because Tab is forcibly bound to NavigationMoveEvent's Next/Previous you may want to stop those events from entering your hierarchy using something similar to this code: // If you send your own Next/Prev event, assign it before calling SendEvent.
private NavigationMoveEvent? _allowedNextPrevEvent;
private void OnEnable()
{
...
rootVisualElement.RegisterCallback<NavigationMoveEvent>(OnNavigationMoveEvent, TrickleDown.TrickleDown);
}
private void OnNavigationMoveEvent(NavigationMoveEvent evt) {
if (evt.direction is not (NavigationMoveEvent.Direction.Next or NavigationMoveEvent.Direction.Previous)
|| evt.propagationPhase != PropagationPhase.TrickleDown) {
// Allow other directions or subsequent phases.
return;
}
if (evt == _allowedNextPrevEvent) {
// Allow a manually assigned event.
_allowedNextPrevEvent = null;
return;
}
// Stop handling this event because it was likely sent from the forcibly-enabled internal Tab-handling code.
evt.StopImmediatePropagation();
_document.rootVisualElement.focusController.IgnoreEvent(evt);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Manual/UIE-faq-event-and-input-system
https://docs.unity3d.com/Manual/UIE-faq-event-and-input-system.html
Beta Was this translation helpful? Give feedback.
All reactions