Fix key handling in AppView

- Now offering to menu if it has focus so that it
  can do its things. Essentially if menu is visible
  it take keys.
- Relates #807
This commit is contained in:
Janne Valkealahti
2023-07-23 09:04:29 +01:00
parent 3a2d7d4817
commit d4bfe610a9
2 changed files with 52 additions and 0 deletions

View File

@@ -107,6 +107,11 @@ public class AppView extends BoxView {
}
return KeyHandler.resultOf(event, consumed, null);
};
// if menu has focus, take from there
if (menu != null && menu.hasFocus()) {
return menu.getKeyHandler();
}
KeyHandler otherHandler = main != null ? main.getKeyHandler() : super.getKeyHandler();
return otherHandler.thenIfNotConsumed(handler);
}