react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

A lot of tabs shows scrollbar and crashes the application

Open tkvw opened this issue 7 years ago • 11 comments

Example app: https://pp0o4x40p0.codesandbox.io/#/posts/13

I just copied the last tab a couple of times and you'll see a scrollbar at the bottom. What I expected: that the Tabs component would be scrollable and the application not to crash. I think this is because the Tabs parent width is implicit instead of explicit. 2018-03-22_09-51-42

tkvw avatar Mar 22 '18 08:03 tkvw

I believe it's a material-ui bug.

fzaninotto avatar Mar 22 '18 10:03 fzaninotto

So I believe it's because the clientWidth can't be calculated correctly. This can be fixed by adding minWidth:0 on the content class of the Layout component.

tkvw avatar Mar 22 '18 10:03 tkvw

@tkvw Would you mind sharing the link to your codesandbox reproducing the issue? I couldn't do better than https://codesandbox.io/s/k3wpror8yv.

oliviertassinari avatar Mar 22 '18 23:03 oliviertassinari

@tkvw so is it a material-ui bug, or a react-admin bug?

fzaninotto avatar Mar 30 '18 16:03 fzaninotto

I think react-admin, what I've debugged is that the tabs container needs a fixed width container. Setting minWidth accomplishes this.

tkvw avatar Mar 31 '18 07:03 tkvw

Fixed by #1721

fzaninotto avatar Apr 04 '18 14:04 fzaninotto

#1721 needs to be reverted, Im reopening this one.

fzaninotto avatar May 09 '18 15:05 fzaninotto

I think is a materia-ui bug however I could fixed it by setting the classes passed to <TabbedShowLayoutTabs> with a {width: 0}. Defined a styles object like:

const styles = {
  tabs: {
    width: 0
  }
}

Used with with my Show resource component:

export ResourceShow = withStyles(styles)(ResourceShowView);

And in my view added that class to <TabbedShowLayoutTabs>:

import { Show, TabbedShowLayout, TabbedShowLayoutTabs } from 'react-admin'

const ResourceShowView = ({ classes, ...props}) => (
  <Show {...props} >
    <TabbedShowLayout tabs={<TabbedShowLayoutTabs classes={{scrollable: classes.tabs}} scrollable scrollButtons={'on'}/>}>
      {<YourTabs/>}
    </TabbedShowLayout>
  </Show>
)

I don't know why this happens, but it worked! 😃

PS: Don't know nothing about crashing 😢

MROFerreiro avatar Feb 15 '19 16:02 MROFerreiro

I reproduced with the latest versions (v2 + v3) and the bug is still there. Still, the app doesn't crash.

Kmaschta avatar Oct 09 '19 15:10 Kmaschta

#4538 breaks FormTabs, we have to revert it in #5132. Therefore, we keep this issue open.

fzaninotto avatar Aug 11 '20 09:08 fzaninotto

@tkvw can you assign me this issue, if anyone is not working on it for now ?

akku750156 avatar May 19 '22 13:05 akku750156

No news for some time, closing

djhi avatar Jan 09 '23 08:01 djhi