From 97e61a507ba07d0ecee9b784d8f0cb954155b376 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 17 Sep 2024 10:55:09 +0800 Subject: [PATCH] otp_input: Fix OtpInput to stop_propagation on keydown. (#249) --- crates/ui/src/input/otp_input.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/ui/src/input/otp_input.rs b/crates/ui/src/input/otp_input.rs index 5b6b75bb..5c4559e2 100644 --- a/crates/ui/src/input/otp_input.rs +++ b/crates/ui/src/input/otp_input.rs @@ -113,6 +113,9 @@ impl OtpInput { let ix = ix - 1; chars.remove(ix); } + + cx.prevent_default(); + cx.stop_propagation(); } _ => { let c = key.chars().next().unwrap(); @@ -124,6 +127,9 @@ impl OtpInput { } chars.push(c); + + cx.prevent_default(); + cx.stop_propagation(); } }