diff --git a/src/menus/hud.js b/src/menus/hud.js
index 438696bba..9aef54ef3 100644
--- a/src/menus/hud.js
+++ b/src/menus/hud.js
@@ -2,7 +2,7 @@ import { f3Keybinds } from '../controls'
import { showOptionsModal } from '../react/SelectOption'
const { LitElement, html, css, unsafeCSS } = require('lit')
-const { showModal, miscUiState } = require('../globalState')
+const { showModal, miscUiState, activeModalStack, hideCurrentModal } = require('../globalState')
const { options, watchValue } = require('../optionsStorage')
const { getGamemodeNumber } = require('../utils')
const { isMobile } = require('./components/common')
@@ -231,7 +231,11 @@ class Hud extends LitElement {
}}>F3
{
e.stopPropagation()
- this.shadowRoot.querySelector('#chat').enableChat()
+ if (activeModalStack.at(-1)?.reactType === 'chat') {
+ hideCurrentModal()
+ } else {
+ showModal({ reactType: 'chat' })
+ }
}}>
{
e.stopPropagation()
diff --git a/src/react/ChatContainer.tsx b/src/react/ChatContainer.tsx
index 4c0a80389..853f22f93 100644
--- a/src/react/ChatContainer.tsx
+++ b/src/react/ChatContainer.tsx
@@ -3,6 +3,7 @@ import { isCypress } from '../standaloneUtils'
import { MessageFormatPart } from '../botUtils'
import { MessagePart } from './MessageFormatted'
import './ChatContainer.css'
+import { useUsingTouch } from '@dimaka/interface'
export type Message = {
parts: MessageFormatPart[],
@@ -51,6 +52,8 @@ export const fadeMessage = (message: Message, initialTimeout: boolean, requestUp
}
export default ({ messages, touch, opacity, fetchCompletionItems, opened, interceptMessage, onClose }: Props) => {
+ const usingTouch = useUsingTouch()
+
const [sendHistory, _setSendHistory] = useState(JSON.parse(window.sessionStorage.chatHistory || '[]'))
const [completePadText, setCompletePadText] = useState('')
@@ -114,7 +117,9 @@ export default ({ messages, touch, opacity, fetchCompletionItems, opened, interc
chatHistoryPos.current = messages.length
updateInputValue(initialChatOpenValue.value)
initialChatOpenValue.value = ''
- chatInput.current.focus()
+ if (!usingTouch) {
+ chatInput.current.focus()
+ }
}
if (!opened) {
chatMessages.current.scrollTop = chatMessages.current.scrollHeight