summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/main/viewport.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index ef00dcec49..8df7bb4791 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2058,7 +2058,12 @@ void Viewport::_gui_input_event(InputEvent p_event) {
case InputEvent::JOYSTICK_BUTTON:
case InputEvent::KEY: {
- if (gui.key_focus) {
+ if (gui.key_focus && !gui.key_focus->is_visible()) {
+ //key focus must always be visible
+ gui.key_focus->release_focus();
+ }
+
+ if (gui.key_focus) {
gui.key_event_accepted=false;
if (gui.key_focus->can_process()) {