Skip to content

Commit

Permalink
Merge pull request #1056 from glints-dev/feature/next-tabs-click-fix
Browse files Browse the repository at this point in the history
Tabs: fix disabledScrollToTab logic
  • Loading branch information
music1353 authored Sep 19, 2024
2 parents 669eb59 + c7139f8 commit ea61fee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/@next/Tabs/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ export const Tab = ({
const tabRef = useRef(null);

const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
if (disabled || disabledScrollToTab) return;
if (disabled) return;

event.preventDefault();
tabRef.current.scrollIntoView({ behavior: 'smooth' });
if (!disabledScrollToTab) {
tabRef.current.scrollIntoView({ behavior: 'smooth' });
}
onSelect();
};

Expand Down

0 comments on commit ea61fee

Please sign in to comment.