Repository: godotengine/godot
File: editor/doc/editor_help.cpp (C++)

Code before:
					get_parent_viewport()->set_input_as_handled();
				} else if (Input::get_singleton()->is_any_key_pressed()) {
					if (!_is_shortcut_pressed) {
						queue_free();
					}
				} else if (!Input::get_singleton()->get_mouse_button_mask().is_empty()) {
					if (!_is_mouse_inside_tooltip && !_is_shortcut_pressed) {
						queue_free();
					}
				} else if (!Input::get_singleton()->get_last_mouse_velocity().is_zero_approx()) {
					if (!_is_mouse_inside_tooltip && OS::get_singleton()->get_ticks_msec() - _enter_tree_time > 350) {
						_start_timer();
					}
				}
			}
		} break;
	}
}

Control *EditorHelpBitTooltip::make_tooltip(Control *p_target, const String &p_symbol, const String &p_prologue, bool p_use_class_prefix, bool p_shortcut) {
	ERR_FAIL_NULL_V(p_target, _make_invisible_control());

	// Show the custom tooltip only if it is not already visible.
	// The viewport will retrigger `make_custom_tooltip()` every few seconds
	// because the return control is not visible even if the custom tooltip is displayed.
	if (_is_tooltip_visible || (Input::get_singleton()->is_anything_pressed() && !p_shortcut)) {
		return _make_invisible_control();
	}

	EditorHelpBit *help_bit = memnew(EditorHelpBit(p_symbol, p_prologue, p_use_class_prefix, false, true));

	EditorHelpBitTooltip *tooltip = memnew(EditorHelpBitTooltip(p_target, p_shortcut));
	help_bit->connect("request_hide", callable_mp(static_cast<Node *>(tooltip), &Node::queue_free));
	tooltip->add_child(help_bit);
	p_target->add_child(tooltip);

	help_bit->update_content_height();
	if (tooltip->is_shortcut_pressed()) {
		tooltip->_shortcut_pressed(p_target);
	} else {
		tooltip->popup_under_position(tooltip->get_mouse_position());
	}

	return _make_invisible_control();
}

// Copy-paste from `Viewport::_gui_show_tooltip()`.
void EditorHelpBitTooltip::popup_under_position(const Point2 p_point) {
	Point2 tooltip_offset = GLOBAL_GET_CACHED(Point2, "display/mouse_cursor/tooltip_position_offset");
	Rect2 r(p_point + tooltip_offset, get_contents_minimum_size());
	r.size = r.size.min(get_max_size());

Review comment (suggestion):
```suggestion
	if (_is_tooltip_visible || (!p_shortcut && Input::get_singleton()->is_anything_pressed())) {
```

Code after:
					queue_free();
					get_parent_viewport()->set_input_as_handled();
				} else if (Input::get_singleton()->is_any_key_pressed()) {
					if (!_is_shortcut_pressed) {
						queue_free();
					}
				} else if (!Input::get_singleton()->get_mouse_button_mask().is_empty()) {
					if (!_is_mouse_inside_tooltip && !_is_shortcut_pressed) {
						queue_free();
					}
				} else if (!Input::get_singleton()->get_last_mouse_velocity().is_zero_approx()) {
					if (!_is_mouse_inside_tooltip && OS::get_singleton()->get_ticks_msec() - _enter_tree_time > 350) {
						_start_timer();
					}
				}
			}
		} break;
	}
}

Control *EditorHelpBitTooltip::make_tooltip(Control *p_target, const String &p_symbol, const String &p_prologue, bool p_use_class_prefix, bool p_shortcut) {
	ERR_FAIL_NULL_V(p_target, _make_invisible_control());

	// Show the custom tooltip only if it is not already visible.
	// The viewport will retrigger `make_custom_tooltip()` every few seconds
	// because the return control is not visible even if the custom tooltip is displayed.
	if (_is_tooltip_visible || (!p_shortcut && Input::get_singleton()->is_anything_pressed())) {
		return _make_invisible_control();
	}

	EditorHelpBit *help_bit = memnew(EditorHelpBit(p_symbol, p_prologue, p_use_class_prefix, false, true));

	EditorHelpBitTooltip *tooltip = memnew(EditorHelpBitTooltip(p_target, p_shortcut));
	help_bit->connect("request_hide", callable_mp(static_cast<Node *>(tooltip), &Node::queue_free));
	tooltip->add_child(help_bit);
	p_target->add_child(tooltip);

	help_bit->update_content_height();
	if (tooltip->is_shortcut_pressed()) {
		tooltip->_shortcut_pressed(p_target);
	} else {
		tooltip->popup_under_position(tooltip->get_mouse_position());
	}

	return _make_invisible_control();
}

// Copy-paste from `Viewport::_gui_show_tooltip()`.
void EditorHelpBitTooltip::popup_under_position(const Point2 &p_point) {
	Point2 tooltip_offset = GLOBAL_GET_CACHED(Point2, "display/mouse_cursor/tooltip_position_offset");
	Rect2 r(p_point + tooltip_offset, get_contents_minimum_size());