Skip to content

Commit

Permalink
fix(use-tabs): scroll only horizontally
Browse files Browse the repository at this point in the history
Scrolls the tabs only horizontally
  • Loading branch information
megheaiulian authored and cristinecula committed Sep 30, 2021
1 parent f5a8a75 commit 4d795ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/use-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const useTabSelectedEffect = (host, selectedTab) => {
}, [selectedTab]);

useEffect(() => {
host.shadowRoot.querySelector('a[aria-selected]')?.scrollIntoView?.({ inline: 'center', behavior: 'smooth' });
host.shadowRoot.querySelector('a[aria-selected]')?.scrollIntoView?.({ block: 'nearest', inline: 'center', behavior: 'smooth' });
}, [selectedTab]);

const href = useCallback(tab => isValid(tab) ? link(hashParam, getName(tab)) : undefined, [hashParam]);
Expand Down

0 comments on commit 4d795ac

Please sign in to comment.