Skip to main content

Module password_field

Module password_field 

Source
Expand description

PasswordField — secure single-line text entry with a reveal toggle, masking, Caps Lock warning, and clipboard protection.

A thin, ergonomic preset over a secure TextInputField composed SpinBox-style: the field + an embedded reveal button live inside one bordered frame with a unified focus halo. Masking happens at the text-engine layer (one echo glyph per source char), so the plaintext never reaches the shaper or glyph atlas while masked, and caret / selection / hit-test stay correct.

On Linux, while a screen reader is attached, Teksilo reports each key to the AT-SPI registry, which is how Orca hears keys in a Wayland session (teksilo_platform::key_report). A key typed into this field, revealed or not, goes there without its character: no text, and the keysym VoidSymbol. Its physical keycode and modifiers still go, because Orca matches its own commands on them, so a process listening to the registry can tell which physical keys were pressed. GTK 3 and Qt report the character too.

Feature parity target: Qt QLineEdit echo modes, SwiftUI SecureField, WinUI PasswordBox / PasswordRevealMode, and the Android password_toggle.

§Example

ⓘ
let password = ctx.signal(String::new());
PasswordField::new(password.clone())
    .label(tr!(password()))               // or .label(lit!("Password"))
    .placeholder(tr!(password_hint()))    // i18n-first; `_literal` twins bypass i18n
    .validator(|s| if s.len() >= 8 {
        ValidationOutcome::Valid
    } else {
        ValidationOutcome::Invalid { message: "Too short".into() }
    })

Re-exports§

pub use crate::primitives::text_input_field::AtRevealPolicy;
pub use crate::primitives::text_input_field::EchoMode;

Structs§

PasswordField
Secure single-line text entry. See the module docs.

Enums§

RevealMode
How the reveal affordance behaves. Mirrors WinUI’s PasswordRevealMode.