-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New directional_navigation_overrides example combining auto dir nav w/ manual overrides
#22405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
it-me-joda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that I personally would rather have each navigation mode in a separate example. Then maybe a third that demonstrates that you could combine them? This current state is overwhelming at first glance. I think I would have examples like:
ui/navigation/
auto-navigation
manual-navigation
combined-navigation
But that's just my personal opinion. I'd be curious to see what others think about it.
|
I agree with @it-me-joda here, with the emphasis in the third example focusing on how and why to use overrides. |
159b127 to
fc1c24d
Compare
8709d09 to
425a63b
Compare
navigation example combining auto and manual directional navcombined_navigation example combining auto and manual directional nav
|
Alrighty this is ready for review again! I refactored the navigation examples, tried to make a clear example where combined navigation is best suited, and put in the I updated the screen recording with this example in the first comment. Basically it is now three pages of buttons where transitions between pages and rows is and must be set up manually, but all other navigation is via the automatic system. |
|
One of the motivations for manual navigation is to resolve ambiguities in automatic navigation. Consider the following: In this example, we might want |
Thanks for this! I’ll try to fit something like this in the example, probably as a separate bespoke page of buttons depicting this (or replacing one of the pages with this scenario) |
|
I incorporated @viridia ’s scenario as the page 2 of buttons ,and I inverted vertical navigation in page 3 to demonstrate a whimsy override. The updated screen recording (which is also available in the description) is hereScreen.Recording.2026-01-13.at.1.46.09.AM.mov |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, this is starting to look good!
There's a few notes on pedagogical structure:
- Automatic directional navigation should be the default for 99% of users; the example should be renamed to simply
directional_navigation. - Now that it exists, the
manual_navigationexample is misleading: no one should be doing this. It should be removed completely. - The primary point of manual navigation is now for overriding edge cases produced by automatic directional navigation. The example name and module docs providing context should be reworked to reflect that; perhaps
directional_navigation_overrides.rs?
The setup and content of the new example are quite nice though; I have no complaints there! Lots of boilerplate to set up the complex layout, but I'm happy with how clear it is.
39207ce to
f246aeb
Compare
|
@alice-i-cecile I agree with your structure notes and implemented them. I also went over the comments in the modules and updated them to the best of my ability to make the recommended uses clearer and the interactions with each other I’m happy with the example now too :) feels comprehensive |
combined_navigation example combining auto and manual directional navdirectional_navigation_overrides example combining auto dir nav w/ manual overrides
Objective
bevy_input_focus: No example demonstrates how to use theDirectionalNavigationMapand automatic navigation together #22299Solution
directional_navigation_overrides(examples/ui/navigation/directional_navigation_overrides.rs) that demonstrates both auto navigation and manually defining edges via theDirectionalNavigationMap. The example uses the previous auto navigation example (now atexamples/ui/navigation/directional_navigation.rs) as a base. It creates pages ofAutoDirectionalNavigationbuttons depicting different scenarioes where manual navigation is needed to create a desired experience.Testing
cargo run --example directional_navigation_overrides. Screen recording attached.cargo run --example directional_navigationShowcase
Screen Recording
Screen.Recording.2026-01-13.at.1.46.09.AM.mov