mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.94k stars 32.27k forks source link

TabIndicator in wrong position if scrollbars appears later #13263

Closed FalkNisius closed 6 years ago

FalkNisius commented 6 years ago

I have some pages where navigation is done with Tabs (centered) and Tab Component. After loading the component, asynchronous data are loaded. The painting of the changed react component, let appears vertical scrollbars and the Tabs are moved left and TabIndicator hold its place, because it is absolute positioned. After resizing the window or a new navigation, the position is correct.

Expected Behavior

The tab indicator should be at all circumstances under the tab after navigation is ready:

image

Current Behavior

The tab indicator is placed a half scrollbar width too much right, because on appearing of the scrollbar the centered tabs are moved to center automatically, but the tab indicator not:

image

Steps to Reproduce

It is easier to see if the active tab component has an background-color. It is only reproducable if scrollbars in the browser are visible and are shown after navigation is completely done. Sorry that I can't produce fast a fiddle for it.

const styles = theme => ({ tabSelected: { backgroundColor: '#f5f5f5' } })

<Tabs value={self.state.tab} onChange={(event, value) => {self.setState({tab: value})}}
                centered
                indicatorColor="secondary"
                textColor="secondary" className='topNavigation'>
            <Tab value={0} label='Installations' component={Link} to='/monthly'
                 classes={{selected: classes.tabSelected}}/>
            <Tab value={1} label='Usages' component={Link} to='/usages/monthly'
                 classes={{selected: classes.tabSelected}}/>
            <Tab value={2} label='Clients' component={Link} to='/clients'
                 classes={{selected: classes.tabSelected}}/>
          </Tabs>

Context

Your Environment

Tech Version
Material-UI v3.2.1
React 16.5.2
Browser Chrome 69.0.3497.100
oliviertassinari commented 6 years ago

@FalkNisius I'm closing as a duplicate of #9337.