File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2184,6 +2184,18 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
21842184 return ;
21852185 }
21862186
2187+ if (p_event->is_action_pressed (" ui_cancel" )) {
2188+ // Cancel tooltip timer or hide tooltip when pressing Escape (this is standard behavior in most applications).
2189+ _gui_cancel_tooltip ();
2190+ if (gui.tooltip_popup ) {
2191+ // If a tooltip was hidden, prevent other actions associated with `ui_cancel` from occurring.
2192+ // For instance, this prevents the node from being deselected when pressing Escape
2193+ // to hide a documentation tooltip in the inspector.
2194+ set_input_as_handled ();
2195+ return ;
2196+ }
2197+ }
2198+
21872199 if (gui.key_focus && !gui.key_focus ->is_visible_in_tree ()) {
21882200 gui.key_focus ->release_focus ();
21892201 }
You can’t perform that action at this time.
0 commit comments