Skip to content

Commit 417cb64

Browse files
Merge pull request #9587 from circleci/fix-responsive-wide-content
Fix responsive behaviour for wide content
2 parents 33e54df + e3ad0b6 commit 417cb64

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

ui/src/css/base.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ object[type="image/svg+xml"]:not([width]) {
148148

149149
/* Firefox-specific CSS to fix flexbox shrinking issue */
150150
@-moz-document url-prefix() {
151-
main > .content .doc,
151+
main > div .doc,
152152
article.doc {
153153
flex-shrink: 0; /* Prevent excessive shrinking in Firefox */
154154
}

ui/src/css/doc.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
}
1818
}
1919

20+
/* Apply aggressive flexbox fix only above 1200px where the original problem occurs */
21+
@media screen and (min-width: 1200px) {
22+
.doc {
23+
flex: 1 1 0%;
24+
width: 0; /* Force flexbox to ignore content width */
25+
max-width: var(--doc-max-width--desktop); /* Restore max-width for centering */
26+
}
27+
}
28+
2029
/* === HEADING STYLES === */
2130
.doc h1,
2231
.doc h2,

ui/src/css/main.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ body.-toc aside.toc.sidebar {
77
display: none;
88
}
99

10-
main > .content {
10+
main > div {
1111
overflow-x: auto;
1212
max-width: 100vw;
1313
}
@@ -19,7 +19,7 @@ body.-toc aside.toc.sidebar {
1919
min-width: 0; /* min-width: 0 required for flexbox to constrain overflowing elements */
2020
}
2121

22-
main > .content {
22+
main > div {
2323
display: flex;
2424
}
2525

@@ -33,8 +33,19 @@ body.-toc aside.toc.sidebar {
3333
}
3434
}
3535

36+
@media screen and (min-width: 1280px) { /* Use xl breakpoint to match existing xl:items-center */
37+
main {
38+
max-width: calc(var(--doc-max-width--desktop) + var(--toc-width)); /* Article + TOC */
39+
/* Let parent xl:items-center handle the centering */
40+
}
41+
}
42+
3643
@media screen and (min-width: 1600px) {
3744
aside.toc.sidebar {
3845
flex-basis: var(--toc-width--widescreen);
3946
}
47+
48+
main {
49+
max-width: calc(var(--doc-max-width--desktop) + var(--toc-width--widescreen)); /* Article + wider TOC */
50+
}
4051
}

ui/src/partials/main.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<main class="article w-fit-content max-w-screen">
1+
<main class="article w-full max-w-screen">
22
{{> article-toolbar}}
33
<div class="flex flex-col lg:flex-row w-full">
44
{{#if (eq page.layout '404')}}

0 commit comments

Comments
 (0)