Skip to content

Commit 26834d2

Browse files
committed
Merge pull request #85652 from rsubtil/bugfix-can_grab_focus
Ensure slider grabs focus only when it can
2 parents 252c462 + fde51ae commit 26834d2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scene/gui/slider.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,14 @@ void Slider::gui_input(const Ref<InputEvent> &p_event) {
8888
}
8989
} else if (scrollable) {
9090
if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
91-
grab_focus();
91+
if (get_focus_mode() != FOCUS_NONE) {
92+
grab_focus();
93+
}
9294
set_value(get_value() + get_step());
9395
} else if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
94-
grab_focus();
96+
if (get_focus_mode() != FOCUS_NONE) {
97+
grab_focus();
98+
}
9599
set_value(get_value() - get_step());
96100
}
97101
}

0 commit comments

Comments
 (0)