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

Fix table regressions. #9306

Merged
merged 4 commits into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/block-library/src/table/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.wp-block-table {
// Fixed layout toggle
&.has-fixed-layout tbody {
&.has-fixed-layout thead,
&.has-fixed-layout tbody,
&.has-fixed-layout tfoot {
display: table;
table-layout: fixed;
width: 100%;
}
}
6 changes: 5 additions & 1 deletion packages/block-library/src/table/theme.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
.wp-block-table {
overflow-x: auto;
display: block; // Necessary in order for this table to be mobile responsive.
Copy link
Member

Choose a reason for hiding this comment

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

This seems odd to me, changing display of a table element. I had some problem with this rule in a PR, so I took it out. What Exactly does mobile responsive mean here? Could you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To answer your question, if we had the whole thing wrapped in a div, we could do this instead:

https://codepen.io/joen/pen/RYojVZ?editors=1100

But as the markup is today, we need to leverage the table as the full-width block to hold the horizontal scrollbar, and then make a child element of that (in this case, tbody/thead/tfoot) be the full-wide table that has a min-width.

border-collapse: collapse;
width: 100%;

tbody {
thead,
tbody,
tfoot {
width: 100%;
min-width: $break-mobile / 2;
display: table;
}

td,
Expand Down