fix(reply modal): autofocus caused auto scroll to top on mobile

This commit is contained in:
plebeius.eth
2024-04-30 11:35:47 +02:00
parent 1e91119687
commit 952d446c4d
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ const ReplyModal = ({ closeModal, parentCid, scrollY }: ReplyModalProps) => {
ref={textRef}
placeholder={_.capitalize(t('comment'))}
onChange={(e) => setContent.content(e.target.value)}
autoFocus
autoFocus={!isMobile} // autofocus causes auto scroll to top on mobile
/>
</div>
<div className={styles.footer}>
+2 -1
View File
@@ -17,7 +17,8 @@ const useReplyModal = () => {
const openReplyModal = useCallback(
(cid: string) => {
if (isMobile) {
setScrollY(window.scrollY);
const currentScrollY = window.scrollY;
setScrollY(currentScrollY);
}
if (activeCid && activeCid !== cid) {
closeModal();