Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Table] add Responsive table option #9268

Closed
wants to merge 11 commits into from
Closed

[Table] add Responsive table option #9268

wants to merge 11 commits into from

Conversation

Skaronator
Copy link
Contributor

Closes: #9221

@mbrookes mbrookes added the component: table This is the name of the generic UI component, not the React module! label Nov 22, 2017
@mbrookes
Copy link
Member

mbrookes commented Nov 22, 2017

@Skaronator This seems to have a problem at narrower widths:

image

However the existing implementation already works as expected, without the additional prop:

image

@Skaronator
Copy link
Contributor Author

@mbrookes Fixed. Was only in the demo though.

@mbrookes
Copy link
Member

Then it seems like that should be the default. I can't imagine a valid use-case for having the content overflow the container.

@Skaronator
Copy link
Contributor Author

However the existing implementation already works as expected, without the additional prop:

Thats because the Demo Frame is using overflowX: 'auto' as well. It would look pretty ugly if it wouldn't do that. The only way to counter this would be to minimize the column count.

Then it seems like that should be the default. I can't imagine a valid use-case for having the content overflow the container.

Yes it should be always responsive IMO . The weird thing is Bootstrap 4 now has responsive classes for each view breakpoint. As you can see here they now have .table-responsive{-sm|-md|-lg|-xl}.

Just checked the github repo from bootstrap and looks like @pat270 added it via twbs/bootstrap#22804

@mbrookes
Copy link
Member

Thats because the Demo Frame is using overflowX: 'auto'

Yes, that's what I was suggesting should be the default.

The weird thing is Bootstrap 4 now has responsive classes for each view breakpoint.

I'm not clear on what happens there when above the breakpoint size at which overflowX: 'auto' is applied. Is the content hidden? (doesn't seem useful); Does it messily overflow? (Doesn't seem useful.) Something else?

For the purpose of this PR, I'd suggest making overflowX: 'auto' the default, and drop any references to "responsive". There'll be no need for the demo either, so the PR will be a one-line change. 👍

@Skaronator
Copy link
Contributor Author

I'm not clear on what happens there when above the breakpoint size at which overflowX: 'auto' is applied. Is the content hidden? (doesn't seem useful); Does it messily overflow? (Doesn't seem useful.) Something else?

No clue. I think it just overflow and break the whole layout. Pretty ridiculous if you ask me.

I've updated the PR. All tables are now responsive.

@Skaronator
Copy link
Contributor Author

Skaronator commented Nov 26, 2017

Mh the display: block destroys the table layout on desktop. I could fix that by wrapping around a <div> and do the overflow on the div but I would like to avoid that.

I'll check this later.

<ComponentProp className={classes.table} {...other}>
{children}
</ComponentProp>
<div className={divWrapper} {...other}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still hate this. Maybe I should move the classNameProp variable and {...other} props back to <ComponentProp>?

Copy link
Member

@mbrookes mbrookes Nov 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't appreciated the need for adding a wrapper. It explains why it was part of the demo, not the default behavior. We have other components that similarly require a suitably formatted container, such as GridList.

It seems right that <Table> should create a <table>.

Can we return to the beginning? What were you trying to achieve that the current Table doesn't already do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we return to the beginning? What were you trying to achieve that the current Table doesn't already do?

The current table overflows by default which is kinda bad since this is a mobile optimized framework. So I requested a responsive table option in #9221 familar to the bootstrap responsive-table thing.

I made a PR for it and then you said, that tables should be always responsive since there is no reason not to have a responsive table at all, which is true.

@mbrookes
Copy link
Member

The current table overflows by default [...] So I requested a responsive table option

Responsive isn't really the right word for it, rather not overflowing its container. I should have looked more closely at what component the style was applied to I didn't anticipate you having to move the container into the component.

Unfortunately the current solution introduces some new issues, so while I appreciate your efforts, it may be best to leave things as they are. If you wanted to make that more explicit in the docs by mentioning that the container needs to have overflowX: 'auto' applied that mightn't be a bad thing.

@mbrookes
Copy link
Member

mbrookes commented Dec 1, 2017

Skarantor, thanks for your efforts, but I"m closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants