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}
|
||||
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}>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user