Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dismiss currently visible or upcoming tooltips when pressing Escape #80364

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,18 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
return;
}

if (p_event->is_action_pressed("ui_cancel")) {
// Cancel tooltip timer or hide tooltip when pressing Escape (this is standard behavior in most applications).
_gui_cancel_tooltip();
if (gui.tooltip_popup) {
// If a tooltip was hidden, prevent other actions associated with `ui_cancel` from occurring.
// For instance, this prevents the node from being deselected when pressing Escape
// to hide a documentation tooltip in the inspector.
set_input_as_handled();
return;
}
}

if (gui.key_focus && !gui.key_focus->is_visible_in_tree()) {
gui.key_focus->release_focus();
}
Expand Down
Loading