Skip to content

Commit

Permalink
Remove auto scroll from tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
calebjacob committed Aug 1, 2024
1 parent 15823f1 commit 2ee8594
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-pagoda/ui",
"version": "0.2.5",
"version": "0.2.6",
"description": "A React component library that implements the official NEAR design system.",
"license": "MIT",
"repository": {
Expand Down
18 changes: 1 addition & 17 deletions src/components/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,8 @@ type TriggerProps = ComponentProps<typeof Primitive.Trigger> & {

export const Root = forwardRef<HTMLDivElement, RootProps>(
({ size = 'default', value, variant = 'line', ...props }, ref) => {
const elementRef = useRef<HTMLDivElement | null>(null);

useEffect(() => {
const target = elementRef.current?.querySelector('[data-state="active"]') as HTMLButtonElement;
if (target) {
target.scrollIntoView();
}
}, [value]);

return (
<Primitive.Root
className={s.root}
data-size={size}
data-variant={variant}
value={value}
ref={mergeRefs([ref, elementRef])}
{...props}
/>
<Primitive.Root className={s.root} data-size={size} data-variant={variant} value={value} ref={ref} {...props} />
);
},
);
Expand Down

0 comments on commit 2ee8594

Please sign in to comment.