io/router: try all handlers if a key don't match the focus ancestor tree

When a key.InputOp is focused, a key.Event is matched to it and its ancestors.
If there is no focus, every handler is matched.
This change always matches to every handler, after checking the focus and
its ancestors.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-07-20 10:37:28 +02:00
parent 2993ba1838
commit 28c206fc78
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -202,6 +202,12 @@ func (q *Router) queueKeyEvent(e key.Event) {
n := &pq.hitTree[idx]
if focused {
idx = n.next
if idx == -1 {
// No handler found in focus ancestor tree.
// Try all handlers.
idx = len(pq.hitTree) - 1
focused = false
}
} else {
idx--
}