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

Use auto table-layout on desktop #1601

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
57 changes: 31 additions & 26 deletions assets/scss/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -350,19 +350,37 @@ footer {
}

table {
/* Docsy makes all tables "responsive tables", which causes Bootstrap 4 to create
* tables with a "display" property of "block".
*
* However, for "table-layout: fixed" to be effective, an element must have a
* "display" property of "table".
*
* Thus, we override the "display" property here. This may no longer be necessary once
* Docsy updates to Bootstrap v5+: https://github.com/google/docsy/issues/470.
* For more details, see
* https://github.com/matrix-org/matrix-spec/pull/1295/files#r1010759688 */
display: table;
table-layout: fixed;
width: 100%;
@media (max-width: 800px) {
/* Docsy by default applies `overflow-x: auto;` to tables, which
* results in annoying horizontal scrolling on mobile, so we instead
* switch to a fixed table layout on a narrow browser width.
* (On a wider width the default auto table-layout provides better readability.)
*
richvdh marked this conversation as resolved.
Show resolved Hide resolved
* Docsy makes all tables "responsive tables", which causes Bootstrap 4 to create
* tables with a "display" property of "block".
* However, for "table-layout: fixed" to be effective, an element must have a
* "display" property of "table".
*
* Thus, we override the "display" property here. This may no longer be necessary once
* Docsy updates to Bootstrap v5+: https://github.com/google/docsy/issues/470.
* For more details, see
* https://github.com/matrix-org/matrix-spec/pull/1295/files#r1010759688 */
Comment on lines +364 to +367
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should update our fork of docsy now that google/docsy#470 is closed...

Anyway, I guess that is a separate problem.

display: table;
table-layout: fixed;
width: 100%;

.col-name, .col-type, .col-status {
width: 25%;
}

.col-description {
width: 50%;
}

.col-status-description {
width: 75%;
}
}

// add some space between two tables when they are right next to each other
& + table {
Expand Down Expand Up @@ -409,19 +427,6 @@ footer {
&.basic-info th {
width: 15rem;
}

.col-name, .col-type, .col-status {
width: 25%;
}

.col-description {
width: 50%;
}

.col-status-description {
width: 75%;
}

}

pre {
Expand Down
1 change: 1 addition & 0 deletions changelogs/internal/newsfragments/1601.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve the layout of tables on desktop displays. Contributed by @not-my-profile.
Loading