Merge pull request #110894 from Giganzo/spinbox-focus-state

Fix SpinBox stepper grabbing focus state on mouse input
This commit is contained in:
Thaddeus Crews 2025-09-30 20:10:39 -05:00
commit 131d6b14a2
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC

View file

@ -257,7 +257,7 @@ void SpinBox::gui_input(const Ref<InputEvent> &p_event) {
switch (mb->get_button_index()) {
case MouseButton::LEFT: {
accepted = true;
line_edit->grab_focus();
line_edit->grab_focus(true);
if (mouse_on_up_button || mouse_on_down_button) {
// Arrow button is being pressed. Snap the value to next step.
@ -281,7 +281,7 @@ void SpinBox::gui_input(const Ref<InputEvent> &p_event) {
drag.capture_pos = mb->get_position();
} break;
case MouseButton::RIGHT: {
line_edit->grab_focus();
line_edit->grab_focus(true);
if (mouse_on_up_button || mouse_on_down_button) {
set_value(mouse_on_up_button ? get_max() : get_min());
}