mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
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
|
uninited?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isMobileDevice = window.ontouchstart !== undefined && window.innerWidth < 800
|
||||||
|
|
||||||
const emptyComposer: ComposerState = { text: "", media: null, replyTo: null }
|
const emptyComposer: ComposerState = { text: "", media: null, replyTo: null }
|
||||||
const uninitedComposer: ComposerState = { ...emptyComposer, uninited: true }
|
const uninitedComposer: ComposerState = { ...emptyComposer, uninited: true }
|
||||||
const composerReducer = (state: ComposerState, action: Partial<ComposerState>) =>
|
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}/>}
|
{state.media && <ComposerMedia content={state.media} clearMedia={clearMedia}/>}
|
||||||
<div className="input-area">
|
<div className="input-area">
|
||||||
<textarea
|
<textarea
|
||||||
autoFocus
|
autoFocus={!isMobileDevice}
|
||||||
ref={textInput}
|
ref={textInput}
|
||||||
rows={textRows.current}
|
rows={textRows.current}
|
||||||
value={state.text}
|
value={state.text}
|
||||||
|
|
Loading…
Add table
Reference in a new issue