diff --git a/.changeset/gentle-countries-rest.md b/.changeset/gentle-countries-rest.md new file mode 100644 index 00000000000..8ef80059a75 --- /dev/null +++ b/.changeset/gentle-countries-rest.md @@ -0,0 +1,9 @@ +--- +"@primer/react": patch +--- + +Fix overflow issues in `PageLayout.Content` + +| Before | After | +|--------|--------| +| image | image | diff --git a/src/PageLayout/PageLayout.stories.tsx b/src/PageLayout/PageLayout.stories.tsx index 7a2da4f4db7..0e815fb7987 100644 --- a/src/PageLayout/PageLayout.stories.tsx +++ b/src/PageLayout/PageLayout.stories.tsx @@ -271,6 +271,21 @@ export const PullRequestPage = () => ( + + This box has really long content. If it is too long, it will cause x overflow and should show a scrollbar. When + this overflows, it should not break to overall page layout! + diff --git a/src/PageLayout/PageLayout.tsx b/src/PageLayout/PageLayout.tsx index 6a70e4dcfdd..b013246e569 100644 --- a/src/PageLayout/PageLayout.tsx +++ b/src/PageLayout/PageLayout.tsx @@ -1,6 +1,6 @@ import React from 'react' -import {Box} from '..' import {BetterSystemStyleObject, merge, SxProp} from '../sx' +import {Box} from '..' const REGION_ORDER = { header: 0, @@ -238,7 +238,8 @@ const Content: React.FC = ({width = 'full', children, sx // than the pane region on wide viewports if its contents are too wide. flexBasis: 0, flexGrow: 1, - flexShrink: 1 + flexShrink: 1, + minWidth: 1 // Hack to prevent overflowing content from pushing the pane region to the next line }, sx )} diff --git a/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap b/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap index 109fa24a96d..cfc3a6d898e 100644 --- a/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap +++ b/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap @@ -28,6 +28,7 @@ exports[`PageLayout renders condensed layout 1`] = ` -webkit-flex-shrink: 1; -ms-flex-negative: 1; flex-shrink: 1; + min-width: 1px; } .c5 { @@ -246,6 +247,7 @@ exports[`PageLayout renders default layout 1`] = ` -webkit-flex-shrink: 1; -ms-flex-negative: 1; flex-shrink: 1; + min-width: 1px; } .c5 { @@ -491,6 +493,7 @@ exports[`PageLayout renders pane in different position when narrow 1`] = ` -webkit-flex-shrink: 1; -ms-flex-negative: 1; flex-shrink: 1; + min-width: 1px; } .c5 { @@ -729,6 +732,7 @@ exports[`PageLayout renders with dividers 1`] = ` -webkit-flex-shrink: 1; -ms-flex-negative: 1; flex-shrink: 1; + min-width: 1px; } .c5 {