Skip to content

Commit 03a98e6

Browse files
committed
Fix text caret being missing with virtual keyboard
1 parent 272472b commit 03a98e6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

addons/onscreenkeyboard/onscreen_keyboard.gd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,16 @@ func _initKeyboard(config_value: String):
130130
var focused_control : Control = null
131131
var focused_window : Window = null
132132

133+
func handle_default_text_nodes(enabled: bool):
134+
if focused_control and (
135+
focused_control is LineEdit or focused_control is TextEdit
136+
):
137+
focused_control.caret_force_displayed = enabled
138+
133139
func show_keyboard(focused_control: Control):
140+
handle_default_text_nodes(false)
134141
self.focused_control = focused_control
142+
handle_default_text_nodes(true)
135143
visible = true
136144

137145
# Set window transience
@@ -140,6 +148,7 @@ func show_keyboard(focused_control: Control):
140148
# Skip current frame to avoid double input when opening the keyboard
141149

142150
func hide_keyboard():
151+
handle_default_text_nodes(false)
143152
await _hideKeyboard()
144153
if focused_window:
145154
focused_window.grab_focus()

0 commit comments

Comments
 (0)