diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index caac2c10771..a69b92465b1 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -859,7 +859,7 @@ void LineEdit::_reset_caret_blink_timer() { void LineEdit::_toggle_draw_caret() { draw_caret = !draw_caret; - if (is_visible()) { + if (is_visible() && has_focus() && window_has_focus) { update(); } } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 24633a7cd18..18725734702 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3350,7 +3350,7 @@ void TextEdit::_reset_caret_blink_timer() { void TextEdit::_toggle_draw_caret() { draw_caret = !draw_caret; - if (is_visible()) { + if (is_visible() && has_focus() && window_has_focus) { update(); } }