From cc8000042a04e09fa33ed78ff69d8be61c3e21f5 Mon Sep 17 00:00:00 2001 From: Alexander Maryanovsky Date: Thu, 28 Mar 2024 11:56:57 +0200 Subject: [PATCH] Check whether event type is KeyDown after processing typed events. --- .../text2/input/internal/TextFieldKeyEventHandler.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldKeyEventHandler.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldKeyEventHandler.kt index e2c3e4171c186..f7a0184ffd32a 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldKeyEventHandler.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldKeyEventHandler.kt @@ -76,10 +76,6 @@ internal abstract class TextFieldKeyEventHandler { singleLine: Boolean, onSubmit: () -> Unit ): Boolean { - if (event.type != KeyEventType.KeyDown) { - return false - } - if (event.isTypedEvent) { val codePoint = deadKeyCombiner.consume(event) if (codePoint != null) { @@ -97,6 +93,10 @@ internal abstract class TextFieldKeyEventHandler { } } + if (event.type != KeyEventType.KeyDown) { + return false + } + val command = keyMapping.map(event) if (command == null || (command.editsText && !editable)) { return false