xonecas.io
70160
Ce

cel-tui / commit dab1c55

fix(core): key bubbling no longer spuriously renders when all handlers return false

When all onKeyPress handlers in the focused element's path return false,
the key is not consumed. Previously this still triggered cel.render()
and fell through to the root handler (calling it twice). Now: the key
is correctly not-consumed (no render), and the focused path always
returns after bubbling completes (no double-dispatch to root).

xonecas2026-04-04 dab1c555b741a358740a576a210c79c1e5806ecf parent 5e236a4

1 file changed

packages/core/src/cel.ts+5−4
@@ -707,10 +707,11 @@ function handleKeyEvent(key: string, rawData?: string): void {
707707 }
708708 // result === false → key not consumed, keep bubbling
709709 }
710- if (consumed || handlers.length > 0) {
711- cel.render();
712- return;
713- }
710+ // Always return — the key was offered to every handler in the
711+ // focused element's path (including root). Even if all returned
712+ // false, we don't retry via the unfocused fallback path.
713+ if (consumed) cel.render();
714+ return;
714715 }
715716 }
716717 }