Skip to content

Commit

Permalink
fix(Tabs): apply scrollIntoView prop on mount (#7543)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
emyarod and kodiakhq[bot] authored Jan 19, 2021
1 parent 5e9ab8d commit da821e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react/src/components/Tabs/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ export default class Tabs extends React.Component {
tab?.tabAnchor?.offsetParent.getBoundingClientRect().right;
const rightOverflowNavButtonHidden =
tablistScrollLeft + tablistClientWidth === tablistScrollWidth;
tab?.tabAnchor?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
this.props.scrollIntoView &&
tab?.tabAnchor?.scrollIntoView({ block: 'nearest', inline: 'nearest' });

// account for overflow buttons in scroll position on mount
if (!leftOverflowNavButtonHidden && !rightOverflowNavButtonHidden) {
Expand Down

0 comments on commit da821e3

Please sign in to comment.