diff --git a/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift b/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift index 9785f61b9..df81d231f 100644 --- a/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift +++ b/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift @@ -103,7 +103,7 @@ struct GlobalSearchScreen: View { Button("") { context.send(viewAction: .dismiss) } - // Need this to enable escape on the textfield and forward the presses + // Need this to enable escape on the textField and forward the presses .keyboardShortcut(.escape, modifiers: []) } } diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift index e9e686e94..d2bc02813 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift @@ -30,6 +30,7 @@ struct MessageComposerTextField: View { pasteHandler: pasteHandler) .accessibilityLabel(placeholder) .background(placeholderView, alignment: .topLeading) + .background { keyboardShortcuts } } @ViewBuilder @@ -41,6 +42,16 @@ struct MessageComposerTextField: View { .accessibilityHidden(true) } } + + private var keyboardShortcuts: some View { + Group { + Button("") { + keyHandler(.keyboardEscape) + } + // Need this to enable escape on the textView and forward the presses + .keyboardShortcut(.escape, modifiers: []) + } + } } private struct UITextViewWrapper: UIViewRepresentable {