Skip to content

Commit 6e9e407

Browse files
authored
regression: Prevent composer recreation on viewport resize (RocketChat#39881)
1 parent 4bf957b commit 6e9e407

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable complexity */
22
import { isRoomFederated, isRoomNativeFederated, type IMessage, type ISubscription } from '@rocket.chat/core-typings';
3-
import { useContentBoxSize, useEffectEvent, useSafeRefCallback } from '@rocket.chat/fuselage-hooks';
3+
import { useContentBoxSize, useEffectEvent, useMediaQuery, useSafeRefCallback } from '@rocket.chat/fuselage-hooks';
44
import {
55
MessageComposerAction,
66
MessageComposerToolbarActions,
@@ -142,7 +142,8 @@ const MessageBox = ({
142142
[chat, storageID, quoteChainLimit, room._id, tmid],
143143
);
144144

145-
const autofocusRef = useMessageBoxAutoFocus(!isMobile);
145+
const isTouchDevice = useMediaQuery('(pointer: coarse)');
146+
const autofocusRef = useMessageBoxAutoFocus(!isTouchDevice);
146147

147148
const useEmojis = useUserPreference<boolean>('useEmojis');
148149

0 commit comments

Comments
 (0)