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

Tables in the MDN blog cause scrolling or get clipped #9962

Open
3 tasks done
pepelsbey opened this issue Nov 7, 2023 · 2 comments · May be fixed by #9974
Open
3 tasks done

Tables in the MDN blog cause scrolling or get clipped #9962

pepelsbey opened this issue Nov 7, 2023 · 2 comments · May be fixed by #9974
Labels
blog 🐛 bug Something isn't working, or isn't working as expected effort: small This task is a small effort. has PR Issues that already have a PR idle layout Issues related to alignment, positioning and spacing/margin/padding p2 We want to address this but may have other higher priority items.

Comments

@pepelsbey
Copy link
Member

Summary

Tables in the MDN blog cause scrolling or get clipped in viewports between 426px and 895px (single-column layout) and between 992px and 1136px (two-column layout). As the mobile layout shows, it’s not caused by the table content, but mostly by the way it adapts to a viewport.

URL

https://developer.mozilla.org/en-US/blog/vs-code-tips-tricks/

Reproduction steps

  1. Go to the article in MDN blog
  2. Resize the window somewhere between 426px and 895px
  3. Notice the table behavior

Expected behavior

No content clipping or horizontal scrollbar.

Actual behavior

Content clipping and horizontal scrollbar.

Device

Desktop

Browser

Firefox

Browser version

Stable

Operating system

Mac OS

Screenshot

table.mp4

Anything else?

It might be partially caused by the following code in the index-desktop.scss:

  .table-container {
    margin: 0 -3rem;
    overflow: auto;
    width: 100vw;
  }

width: 100vw doesn’t take into account vertical scrollbars (when they’re permanent, not floating), it’s the viewport width.

Validations

@pepelsbey pepelsbey added layout Issues related to alignment, positioning and spacing/margin/padding blog labels Nov 7, 2023
@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Nov 7, 2023
@caugner caugner added 🐛 bug Something isn't working, or isn't working as expected p2 We want to address this but may have other higher priority items. effort: small This task is a small effort. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Nov 8, 2023
@caugner
Copy link
Contributor

caugner commented Nov 8, 2023

It looks like the bug is caused by BCD tables being wrapped in figure.table-container > figure.table-container-inner and other tables are not wrapped in the figure.table-container-inner:

.table-container {
margin: 0 -3rem;
overflow: auto;
width: 100vw;
}
.table-container-inner {
min-width: max-content;
padding: 0 3rem;

I don't know why we set a negative horizontal margin on the outer container and a padding on the inner container, but the fact that the inner container is missing on that blog table causes it to overflow by 1.5rem on each side.

@caugner caugner linked a pull request Nov 8, 2023 that will close this issue
@caugner caugner added the has PR Issues that already have a PR label Nov 8, 2023
@dipikabh
Copy link
Contributor

dipikabh commented Nov 8, 2023

I have a (related) issue with tables I came across while working on Vultr's post on MDN Blog.

As a quick fix for now, I've replaced the tables with screenshots (not an ideal solution) so that the article remains responsive on mobile devices. Replacing pre-formatted tables (as the one below) with HTML or markdown equivalents was not helping.

Here's one of the tables that was causing the article to be unresponsive:

```bash
┌────┬─────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name            │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼─────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0  │ express-demo    │ default     │ 1.0.0   │ cluster │ 3712     │ 6m     │ 0    │ online    │ 0%       │ 53.4mb   │ root     │ disabled │
│ 1  │ express-demo    │ default     │ 1.0.0   │ cluster │ 3722     │ 6m     │ 0    │ online    │ 0%       │ 53.8mb   │ root     │ disabled │
│ 2  │ express-demo    │ default     │ 1.0.0   │ cluster │ 3732     │ 6m     │ 0    │ online    │ 0%       │ 51.6mb   │ root     │ disabled │
│ 3  │ express-demo    │ default     │ 1.0.0   │ cluster │ 3742     │ 6m     │ 0    │ online    │ 0%       │ 53.6mb   │ root     │ disabled │
└────┴─────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blog 🐛 bug Something isn't working, or isn't working as expected effort: small This task is a small effort. has PR Issues that already have a PR idle layout Issues related to alignment, positioning and spacing/margin/padding p2 We want to address this but may have other higher priority items.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants