Skip to content

fix(chat): properly handle Korean IME input in message textarea #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion starting_point/frontend/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface ChatProps {
const Chat: React.FC<ChatProps> = ({ items, onSendMessage, loading }) => {
const itemsEndRef = useRef<HTMLDivElement>(null)
const [inputMessageText, setinputMessageText] = useState<string>('')
const [composing, setComposing] = useState(false)

const scrollToBottom = () => {
itemsEndRef.current?.scrollIntoView({ behavior: 'instant' })
Expand Down Expand Up @@ -65,8 +66,10 @@ const Chat: React.FC<ChatProps> = ({ items, onSendMessage, loading }) => {
className="m-0 resize-none border-0 focus:outline-none text-sm bg-transparent px-0 py-2 max-h-[20dvh]"
value={inputMessageText}
onChange={e => setinputMessageText(e.target.value)}
onCompositionStart={() => setComposing(true)}
onCompositionEnd={() => setComposing(false)}
onKeyDown={e => {
if (e.key === 'Enter' && !e.shiftKey) {
if (!composing && e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
onSendMessage(inputMessageText)
setinputMessageText('')
Expand Down