Skip to content

Commit 5ac3b2c

Browse files
newfish-cmykc121914yu
authored andcommitted
fix modal close scroll (#4162)
* fix modal close scroll * update refresh
1 parent 79365d8 commit 5ac3b2c

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

packages/web/components/common/MyModal/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const MyModal = ({
5353
allowPinchZoom
5454
scrollBehavior={'inside'}
5555
closeOnOverlayClick={closeOnOverlayClick}
56+
returnFocusOnClose={false}
5657
>
5758
<ModalOverlay />
5859
<ModalContent

packages/web/hooks/useLinkedScroll.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState, ReactNode, useCallback } from 'react';
1+
import { useEffect, useRef, useState, ReactNode } from 'react';
22
import { LinkedListResponse, LinkedPaginationProps } from '../common/fetch/type';
33
import { Box, BoxProps } from '@chakra-ui/react';
44
import { useTranslation } from 'next-i18next';
@@ -64,11 +64,11 @@ export function useLinkedScroll<
6464

6565
let scroolSign = useRef(false);
6666
const { runAsync: loadInitData } = useRequest2(
67-
async (scrollWhenFinish = true) => {
67+
async (scrollWhenFinish = true, refresh = false) => {
6868
if (!currentData || isLoading) return;
6969

7070
const item = dataList.find((item) => item._id === currentData.id);
71-
if (item) {
71+
if (item && !refresh) {
7272
scrollToItem(item._id);
7373
return;
7474
}

projects/app/src/pageComponents/chat/ChatQuoteList/CollectionQuoteReader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ const CollectionReader = ({
260260
quoteRefs={itemRefs as React.MutableRefObject<(HTMLDivElement | null)[]>}
261261
quoteIndex={item.quoteIndex}
262262
setQuoteIndex={setQuoteIndex}
263-
refreshList={() => loadInitData(false)}
263+
refreshList={() => loadInitData(false, true)}
264264
updated={item.updated}
265265
isCurrentSelected={item.isCurrentSelected}
266266
q={item.q}

0 commit comments

Comments
 (0)