From 60f6f74e07f3534eca8feb1c79ae4ae3e634b7e8 Mon Sep 17 00:00:00 2001 From: cogwheel <172976095+cogwheel0@users.noreply.github.com> Date: Sun, 21 Dec 2025 09:16:27 +0530 Subject: [PATCH] fix(a11y): Improve chat input accessibility for Braille keyboards --- .../chat/widgets/modern_chat_input.dart | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/features/chat/widgets/modern_chat_input.dart b/lib/features/chat/widgets/modern_chat_input.dart index 9223aec..66c5fa1 100644 --- a/lib/features/chat/widgets/modern_chat_input.dart +++ b/lib/features/chat/widgets/modern_chat_input.dart @@ -1586,6 +1586,13 @@ class _ModernChatInputState extends ConsumerState // alternative input methods (e.g., Braille keyboards). // The hintText "Ask Conduit" provides sufficient context for // screen readers to identify this as a message input field. + // + // IMPORTANT: Always use TextInputAction.newline for multiline + // chat input. Using TextInputAction.send causes issues with + // Braille keyboards (like Advanced Braille Keyboard) where + // the "confirm" action is used to commit characters, not to + // send messages. The send-on-enter functionality is handled + // by keyboard shortcuts (Enter key) instead. return TextField( controller: _controller, focusNode: _focusNode, @@ -1595,9 +1602,10 @@ class _ModernChatInputState extends ConsumerState maxLines: null, keyboardType: TextInputType.multiline, textCapitalization: TextCapitalization.sentences, - textInputAction: sendOnEnter - ? TextInputAction.send - : TextInputAction.newline, + // Always use newline action for accessibility compatibility. + // Braille keyboards use "confirm" to commit characters, not + // to send messages. Send-on-enter is handled via Shortcuts. + textInputAction: TextInputAction.newline, autofillHints: const [], showCursor: true, scrollPadding: const EdgeInsets.only(bottom: 80), @@ -1638,10 +1646,15 @@ class _ModernChatInputState extends ConsumerState contextMenuBuilder: (context, editableTextState) { return _buildContextMenu(context, editableTextState); }, + // Note: With TextInputAction.newline, onSubmitted is typically + // not called. We keep this callback but don't auto-send to + // maintain compatibility with alternative input methods like + // Braille keyboards where "confirm" means "commit character" + // not "send message". Users can send via the send button or + // keyboard shortcuts (Cmd/Ctrl+Enter, or Enter if enabled). onSubmitted: (_) { - if (sendOnEnter) { - _sendMessage(); - } + // Intentionally not auto-sending here to support Braille + // keyboards and other alternative input methods. }, onTap: () { if (!widget.enabled) return;