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(tables): wrap in table-container-inner #9974

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Nov 8, 2023

Summary

Fixes #9962.

Problem

Tables in blog articles were overflowing on sm/md/lg screens, because they were only wrapped in figure.table-container, but not in figure.table-container-inner (like the BCD table).

Solution

Wrap tables in figure.table-container > figure.table-container.inner.


Screenshots

Before After
image image

How did you test this change?

Ran yarn && yarn dev and opened http://localhost:3000/en-US/blog/vs-code-tips-tricks/#shortcuts_for_navigation locally (requires mdn/mdn-studio).

@caugner caugner requested a review from a team as a code owner November 8, 2023 13:01
@caugner
Copy link
Contributor Author

caugner commented Nov 8, 2023

Unfortunately, the current approach would cause a regression for large tables:

Before

image

After

image

@caugner caugner marked this pull request as draft November 8, 2023 20:16
@github-actions github-actions bot added the idle label Jan 24, 2024
Comment on lines 7 to 9
const figure = $(
'<figure class="table-container"><figure class="table-container-inner"></figure>'
);
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 think the solution might actually be to add a CSS class for these tables that DON'T have the nested table-container-inner:

Suggested change
const figure = $(
'<figure class="table-container"><figure class="table-container-inner"></figure>'
);
const figure = $(
'<figure class="table-container"><figure class="table-container-inner"></figure>'
);
Suggested change
const figure = $(
'<figure class="table-container"><figure class="table-container-inner"></figure>'
);
const figure = $('<figure class="table-container standalone"></figure>');

Copy link

@ShubhamOulkar ShubhamOulkar left a comment

Choose a reason for hiding this comment

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

almost ready

👍 BCD table got its own scroll, all tables OK.

tested page :- http://localhost:3000/en-US/docs/Web/HTML/Element/input

BCD_scroll_x

margin: 0 -3rem;
overflow: auto;
width: 100vw;
width: 100vw !important;

Choose a reason for hiding this comment

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

Suggested change
width: 100vw !important;
width: 100% !important;
before after
BCD_table_overflow_xxl BCD_table_after

Choose a reason for hiding this comment

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

My personal opinion, don't need to overwrite width because .table-container width is 100% applying to all tables. And we don't need view port width. Remove it.

@@ -25,7 +25,7 @@
}
}

.table-container {
.bc-table-outer {

Choose a reason for hiding this comment

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

Mobile view needs following changes

Suggested change
.bc-table-outer {
.table-container{
overflow-x: auto;
}
mobile_issue.mp4

@github-actions github-actions bot added the idle label Feb 28, 2024
Copy link
Contributor

github-actions bot commented Jun 5, 2024

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions bot added merge conflicts 🚧 Please rebase onto or merge the latest main. and removed idle labels Jun 5, 2024
@github-actions github-actions bot added the idle label Jul 6, 2024
@github-actions github-actions bot removed the idle label Aug 16, 2024
@github-actions github-actions bot added the idle label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle merge conflicts 🚧 Please rebase onto or merge the latest main.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tables in the MDN blog cause scrolling or get clipped
2 participants