Browse Source

Invalidate key focus if not visible, fixes #5354

Juan Linietsky 9 năm trước cách đây
mục cha
commit
3185ce64c5
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      scene/main/viewport.cpp

+ 6 - 1
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()) {