From 0968a10fc165984080799551124a96adf6be1fb8 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Mon, 21 Sep 2026 21:23:13 -0600 Subject: [PATCH] fix: arrow keys in text editor on a layer_surface --- winit/src/platform_specific/wayland/sctk_event.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/winit/src/platform_specific/wayland/sctk_event.rs b/winit/src/platform_specific/wayland/sctk_event.rs index 8e771f60..b96f1765 100755 --- a/winit/src/platform_specific/wayland/sctk_event.rs +++ b/winit/src/platform_specific/wayland/sctk_event.rs @@ -627,7 +627,12 @@ impl SctkEvent { keyboard::Event::KeyPressed { key: key.clone(), location: location, - text: ke.utf8.map(|s| s.into()), + // sctk reports keys without a text representation (e.g. arrows, Home) as + // Some("") but winit reports None. Widgets are written against winit's contract. + text: ke + .utf8 + .filter(|s| !s.is_empty()) + .map(|s| s.into()), modifiers: modifiers_to_native(*modifiers), physical_key, repeat: false, @@ -653,7 +658,9 @@ impl SctkEvent { keyboard::Event::KeyPressed { key: key.clone(), location: location, - text: utf8.map(|s| s.into()), + text: utf8 + .filter(|s| !s.is_empty()) + .map(|s| s.into()), modifiers: modifiers_to_native(*modifiers), physical_key, repeat: true,