Work around widgetry focus problem -- allow space or enter to choose a menu entry. Proper fix started and problem described more in #739.

This commit is contained in:
Dustin Carlino 2021-09-10 13:52:55 -07:00
parent 50b8c533bf
commit 8147f49093

View File

@ -153,7 +153,7 @@ impl<T: 'static> WidgetImpl for Menu<T> {
// Handle nav keys // Handle nav keys
#[allow(clippy::collapsible_if)] #[allow(clippy::collapsible_if)]
if ctx.input.pressed(Key::Enter) { if ctx.input.pressed(Key::Enter) || ctx.input.pressed(Key::Space) {
let choice = &self.choices[self.current_idx]; let choice = &self.choices[self.current_idx];
if choice.active { if choice.active {
output.outcome = Outcome::Clicked(choice.label.clone()); output.outcome = Outcome::Clicked(choice.label.clone());