Skip to content

Commit d7f0efb

Browse files
guidocellakasper93
authored andcommitted
context_menu.lua: make ESC close only submenus when they are open
Fixes #17316 (comment)
1 parent 70d3dc5 commit d7f0efb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

player/lua/context_menu.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,14 @@ local function handle_click()
590590
activate_focused_item()
591591
end
592592

593+
local function handle_esc()
594+
if focused_level > 1 then
595+
close_submenu()
596+
else
597+
close()
598+
end
599+
end
600+
593601
local function activate_shortcut(info)
594602
if info.event == "up" then
595603
return
@@ -623,7 +631,7 @@ local bindings = {
623631
PGUP = focus_first,
624632
PGDWN = focus_last,
625633
ENTER = function () activate_focused_item(true) end,
626-
ESC = function () close() end,
634+
ESC = handle_esc,
627635
ANY_UNICODE = activate_shortcut,
628636
}
629637
for _, key in pairs({"UP", "DOWN", "LEFT", "RIGHT", "HOME", "END", "PGUP",

0 commit comments

Comments
 (0)