diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index f7d74b2b492..eecc730f5c2 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -853,7 +853,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 f1a2823e8f6..9b3b047712b 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3458,7 +3458,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(); } }