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 content blowout #739

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Fix content blowout #739

merged 2 commits into from
Jul 18, 2024

Conversation

pouretrebelle
Copy link
Member

@pouretrebelle pouretrebelle commented Jul 5, 2024

In React Brand there are a couple of pages where the content on large screens is wider than other pages. At certain breakpoints it also overlaps the navigation:

This is a quirk of a flex child not collapsing where its children have wider content than the flex calculation. The default min-width is auto, and since there are children with width: 100%, auto corresponds to max-content, which causes the blowout. To fix this we can set the min-width to 0, which will make the children respect the flex calculation.

See https://css-tricks.com/flexbox-truncated-text/#aa-the-solution-is-min-width-0-on-the-flex-child

Before After

SubDomainNavBar content overlapping navigation

SubDomainNavBar page fixed

@pouretrebelle pouretrebelle requested a review from a team as a code owner July 5, 2024 12:33
@pouretrebelle pouretrebelle requested a review from owenniblock July 5, 2024 12:33
Copy link

changeset-bot bot commented Jul 5, 2024

🦋 Changeset detected

Latest commit: 19f85ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/gatsby-theme-doctocat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

In React Brand there are a few pages where the content on large screens
is wider than other pages. At certain breakpoints it also overlaps the
navigation.

This is a quirk of a flex child not collapsing where its children have
wider content than the flex calculation. The default min-width is auto,
and since there are children with width: 100%, auto corresponds
to max-content, which causes the blowout. To fix this we can set the
min-width to 0, which will make the children respect the flex calculation.

See https://css-tricks.com/flexbox-truncated-text/#aa-the-solution-is-min-width-0-on-the-flex-child
@pouretrebelle pouretrebelle force-pushed the pouretrebelle/fix-blowout branch from d5d0e66 to 352203a Compare July 5, 2024 12:43
@pouretrebelle pouretrebelle requested a review from langermank July 15, 2024 09:54
Copy link

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Thank you Charlotte! ❤️

@pouretrebelle pouretrebelle merged commit 5260057 into main Jul 18, 2024
3 checks passed
@pouretrebelle pouretrebelle deleted the pouretrebelle/fix-blowout branch July 18, 2024 12:33
@primer-css primer-css mentioned this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants