휴대폰에서 채팅을 보낸 뒤에도 키보드 유지: "보내기" 버튼을 누르면 포커스가 버튼으로 넘어가 입력 칸이 빠지고 키보드가 내려가던 것을, 버튼의 pointerdown/mousedown 기본 동작을 막아(lib/chat-input keepFocus) 포커스를 입력 칸에 두고, 보낸 뒤에도 입력 칸에 포커스를 다시 줌. 방 채팅(ChatPanel)·그림 맞히기·마피아·라이어 게임 채팅 모두. Esc로 빠져나가기와 포커스가 빠질 때 "입력 중" 끄기는 그대로. chat.e2e.ts(휴대폰 시트에서 보내기 탭)와 games.e2e.ts(catchmind·mafia·liar 보내기 버튼)에 확인 추가, docs/07에 한 줄
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import { haptic, noise, sfx, sounds, tone, useChatSound } from '../../lib/feedba
|
||||
import { useBanner, type BannerTone } from '../card-fx';
|
||||
import { ChatMessage, sameRun } from '../../components/ChatMessage';
|
||||
import { useStickToBottom } from '../../lib/useStickToBottom';
|
||||
import { useTypingSignal } from '../../lib/chat-input';
|
||||
import { keepFocus, useTypingSignal } from '../../lib/chat-input';
|
||||
import type { BoardProps, GameUI, OptionsProps } from '../types';
|
||||
import { helpNow } from './help';
|
||||
import { quickStart } from './quick';
|
||||
@@ -485,6 +485,7 @@ function ChatBox({ v, players, me, act }: { v: MafiaView; players: Record<string
|
||||
const canWrite = !!ch?.canWrite;
|
||||
// "입력 중" only from the public 전체 chat (night channels stay secret).
|
||||
const typing = useTypingSignal('game', canWrite && cur === 'day');
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const why = ch ? ch.why : me ? '이 채팅은 읽기만 할 수 있어요.' : '관전 중에는 채팅을 쓸 수 없어요.';
|
||||
const onTabKey = (e: KeyboardEvent<HTMLDivElement>) => {
|
||||
if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;
|
||||
@@ -542,9 +543,11 @@ function ChatBox({ v, players, me, act }: { v: MafiaView; players: Record<string
|
||||
setText('');
|
||||
typing.stop();
|
||||
pin();
|
||||
inputRef.current?.focus();
|
||||
}}
|
||||
>
|
||||
<input
|
||||
ref={inputRef}
|
||||
className="input"
|
||||
value={text}
|
||||
onChange={(e) => {
|
||||
@@ -557,7 +560,9 @@ function ChatBox({ v, players, me, act }: { v: MafiaView; players: Record<string
|
||||
aria-label={`${CHANNEL_KO[cur]} 채팅 메시지`}
|
||||
enterKeyHint="send"
|
||||
/>
|
||||
<button className="btn btn-primary btn-sm">보내기</button>
|
||||
<button className="btn btn-primary btn-sm" {...keepFocus}>
|
||||
보내기
|
||||
</button>
|
||||
</form>
|
||||
) : (
|
||||
<p className="mf-why">{why}</p>
|
||||
|
||||
Reference in New Issue
Block a user