Skip to content

Commit

Permalink
Merge pull request #69 from tosaken1116/fix/router-push-scroll-#67
Browse files Browse the repository at this point in the history
fix: checkboxをクリックしたときにページ上部までスクロールしないように変更
  • Loading branch information
tosaken1116 authored Oct 5, 2023
2 parents 7e062c6 + 9bd4c00 commit 2f3f6b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/model/CategoryTab/hooks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export const useCategoryTab = (): IUseCategoryTab => {
const onTabChange = (title: string): void => {
params.set('s', title);

router.push(`${path}?${params.toString()}`);
router.push(`${path}?${params.toString()}`, { scroll: false });
};

useEffect(() => {
if (selectedTab == null) {
params.set('s', '総人口');
router.push(`${path}?${params.toString()}`);
router.push(`${path}?${params.toString()}`, { scroll: false });
}
}, [params, path, router, selectedTab]);

Expand Down
2 changes: 1 addition & 1 deletion src/components/model/PrefectureCheckBoxes/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const usePrefectureCheckBoxes = (): IUsePrefectureCheckBoxes => {
params.append('q', target.prefCode.toString());
}

router.push(`${path}?${params.toString()}`);
router.push(`${path}?${params.toString()}`, { scroll: false });
};

const onChange = (target: Response['result'][number]): void => {
Expand Down

0 comments on commit 2f3f6b2

Please sign in to comment.