mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(reply modal): autofocus caused auto scroll to top on mobile
This commit is contained in:
@@ -96,7 +96,7 @@ const ReplyModal = ({ closeModal, parentCid, scrollY }: ReplyModalProps) => {
|
|||||||
ref={textRef}
|
ref={textRef}
|
||||||
placeholder={_.capitalize(t('comment'))}
|
placeholder={_.capitalize(t('comment'))}
|
||||||
onChange={(e) => setContent.content(e.target.value)}
|
onChange={(e) => setContent.content(e.target.value)}
|
||||||
autoFocus
|
autoFocus={!isMobile} // autofocus causes auto scroll to top on mobile
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.footer}>
|
<div className={styles.footer}>
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ const useReplyModal = () => {
|
|||||||
const openReplyModal = useCallback(
|
const openReplyModal = useCallback(
|
||||||
(cid: string) => {
|
(cid: string) => {
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
setScrollY(window.scrollY);
|
const currentScrollY = window.scrollY;
|
||||||
|
setScrollY(currentScrollY);
|
||||||
}
|
}
|
||||||
if (activeCid && activeCid !== cid) {
|
if (activeCid && activeCid !== cid) {
|
||||||
closeModal();
|
closeModal();
|
||||||
|
|||||||
Reference in New Issue
Block a user