From 04eaebdc21bef51843af01399fc839f4124a365a Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Wed, 13 May 2026 18:26:35 +0200 Subject: [PATCH] fix --- lib/bbs/application.rb | 5 +++-- lib/bbs/menu.rb | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/bbs/application.rb b/lib/bbs/application.rb index 2f37c00..97d47b9 100644 --- a/lib/bbs/application.rb +++ b/lib/bbs/application.rb @@ -161,11 +161,12 @@ module BBS def dispatch(event) # An open menubar has priority — its keys (arrows, Enter, hotkeys, Esc) - # must beat any modal window's focused widget. + # must beat any modal window's focused widget. Always swallow events + # while the menu is open so they cannot leak through to windows. if @menubar&.open? result = @menubar.handle_event(event) return :halt if result == :halt - return nil if result + return nil end # Modal windows: top window gets first shot at events diff --git a/lib/bbs/menu.rb b/lib/bbs/menu.rb index 3371613..178da71 100644 --- a/lib/bbs/menu.rb +++ b/lib/bbs/menu.rb @@ -91,8 +91,11 @@ module BBS end def handle_event(event) - return open_via_keyboard(event) if !open? && event.key? - return navigate(event) if open? + return navigate(event) if open? + return open_via_keyboard(event) if event.key? + if event.mouse? && event.mouse.kind == :press && event.mouse.button == :left + return handle_mouse_press(event) + end nil end @@ -142,9 +145,6 @@ module BBS return :handled end end - if event.mouse? && event.mouse.kind == :press && event.mouse.button == :left - return handle_mouse_press(event) - end nil end