Show blinking caret in authentication fields

This commit is contained in:
hz
2026-07-18 14:45:59 -05:00
parent 722d91fe94
commit 33e461fd36
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -316,6 +316,8 @@ func _add_field(parent: VBoxContainer, label_text: String, placeholder: String,
var input := LineEdit.new()
input.placeholder_text = placeholder
input.secret = secret
input.caret_blink = true
input.caret_blink_interval = 0.5
input.custom_minimum_size = Vector2(0, 68)
input.add_theme_font_size_override("font_size", 17)
input.add_theme_font_override("font", Brand.font)
@@ -467,6 +469,7 @@ func _apply_theme() -> void:
for input in fields:
input.add_theme_color_override("font_color", Brand.text_color(dark))
input.add_theme_color_override("font_placeholder_color", Brand.muted_color(dark))
input.add_theme_color_override("caret_color", Brand.SKY_BLUE if dark else Brand.ROYAL_BLUE)
input.add_theme_stylebox_override("normal", Brand.field_box(dark))
input.add_theme_stylebox_override("focus", Brand.field_box(dark, true))
for button in find_children("*", "Button", true, false):
+6
View File
@@ -44,6 +44,12 @@ func _initialize() -> void:
_assert(show_icon != null and password_reveal.icon != null and show_icon != password_reveal.icon, "password visibility should switch bundled eye icons")
password_reveal.free()
password.free()
var field_parent := VBoxContainer.new()
login.add_child(field_parent)
var auth_field: LineEdit = login._add_field(field_parent, "Email", "[email protected]")
_assert(auth_field.caret_blink, "authentication fields should display a blinking caret")
_assert(is_equal_approx(auth_field.caret_blink_interval, 0.5), "authentication field caret should blink at a visible interval")
login.free()
theme_toggle.free()