Attachment Modal: Disable input field autofocus on mobile (#3117)
This commit is contained in:
parent
0a5cded695
commit
6781b496c7
@ -28,6 +28,7 @@ import { selectCurrentLimit } from '../../../global/selectors/limits';
|
||||
import { openSystemFilesDialog } from '../../../util/systemFilesDialog';
|
||||
import buildClassName from '../../../util/buildClassName';
|
||||
import { validateFiles } from '../../../util/files';
|
||||
import { removeAllSelections } from '../../../util/selection';
|
||||
|
||||
import usePrevious from '../../../hooks/usePrevious';
|
||||
import useMentionTooltip from './hooks/useMentionTooltip';
|
||||
@ -239,6 +240,12 @@ const AttachmentModal: FC<OwnProps & StateProps> = ({
|
||||
}
|
||||
}, [attachmentSettings, isOpen, shouldSuggestCompression]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && isMobile) {
|
||||
removeAllSelections();
|
||||
}
|
||||
}, [isMobile, isOpen]);
|
||||
|
||||
const {
|
||||
isContextMenuOpen: isCustomSendMenuOpen,
|
||||
handleContextMenu,
|
||||
|
||||
@ -92,3 +92,8 @@ export function setCaretPosition(element: Node, position: number) {
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
export function removeAllSelections() {
|
||||
const selection = window.getSelection();
|
||||
selection?.removeAllRanges();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user