mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-29 22:02:05 +00:00
fix: Prevent accidental message submission during IME composition
Add isComposing check to prevent Enter key from submitting messages while Japanese (or other) IME input is in progress. Affected components: - AssistantChat - ExpandProjectChat - SpecCreationChat - FolderBrowser - TerminalTabs
This commit is contained in:
@@ -134,7 +134,8 @@ export function AssistantChat({
|
||||
}
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
// Skip if composing (e.g., Japanese IME input)
|
||||
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
handleSend()
|
||||
}
|
||||
|
||||
@@ -88,7 +88,8 @@ export function ExpandProjectChat({
|
||||
}
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
// Skip if composing (e.g., Japanese IME input)
|
||||
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
handleSendMessage()
|
||||
}
|
||||
|
||||
@@ -269,7 +269,8 @@ export function FolderBrowser({ onSelect, onCancel, initialPath }: FolderBrowser
|
||||
className="flex-1"
|
||||
autoFocus
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') handleCreateFolder()
|
||||
// Skip if composing (e.g., Japanese IME input)
|
||||
if (e.key === 'Enter' && !e.nativeEvent.isComposing) handleCreateFolder()
|
||||
if (e.key === 'Escape') {
|
||||
setIsCreatingFolder(false)
|
||||
setNewFolderName('')
|
||||
|
||||
@@ -127,7 +127,8 @@ export function SpecCreationChat({
|
||||
}
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
// Skip if composing (e.g., Japanese IME input)
|
||||
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
handleSendMessage()
|
||||
}
|
||||
|
||||
@@ -96,7 +96,8 @@ export function TerminalTabs({
|
||||
// Handle key events during editing
|
||||
const handleKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent) => {
|
||||
if (e.key === 'Enter') {
|
||||
// Skip if composing (e.g., Japanese IME input)
|
||||
if (e.key === 'Enter' && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
submitEdit()
|
||||
} else if (e.key === 'Escape') {
|
||||
|
||||
Reference in New Issue
Block a user