forked from Mirrors/gomuks
web/composer: don't autofocus on mobile
This commit is contained in:
parent
a2353409bf
commit
f252323b04
1 changed files with 3 additions and 1 deletions
|
@ -38,6 +38,8 @@ interface ComposerState {
|
|||
uninited?: boolean
|
||||
}
|
||||
|
||||
const isMobileDevice = window.ontouchstart !== undefined && window.innerWidth < 800
|
||||
|
||||
const emptyComposer: ComposerState = { text: "", media: null, replyTo: null }
|
||||
const uninitedComposer: ComposerState = { ...emptyComposer, uninited: true }
|
||||
const composerReducer = (state: ComposerState, action: Partial<ComposerState>) =>
|
||||
|
@ -185,7 +187,7 @@ const MessageComposer = ({ room, scrollToBottomRef, setReplyToRef }: MessageComp
|
|||
{state.media && <ComposerMedia content={state.media} clearMedia={clearMedia}/>}
|
||||
<div className="input-area">
|
||||
<textarea
|
||||
autoFocus
|
||||
autoFocus={!isMobileDevice}
|
||||
ref={textInput}
|
||||
rows={textRows.current}
|
||||
value={state.text}
|
||||
|
|
Loading…
Add table
Reference in a new issue