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/6475 Table of Contents overflowing side of window and global footer #140

Merged
merged 8 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 8 additions & 34 deletions source/wp-content/themes/wporg-developer/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ aside[id^="nav_menu"] .widget-title {
.table-of-contents {
display: flex;
flex-direction: column;
min-width: 230px;
min-width: 210px;
border: 1px solid #eee;
margin: 30px 0;
z-index: 1;
Expand Down Expand Up @@ -2034,7 +2034,7 @@ aside[id^="nav_menu"] .widget-title {
}

.items {
overflow-y: scroll;
overflow-y: auto;
}
}
}
Expand Down Expand Up @@ -2243,7 +2243,6 @@ div[class*="-table-of-contents-container"] {
background: linear-gradient(to right, #fafafa 35%, #fff 35%);
max-width: 100%;
padding: 0;
overflow: auto;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A parent with this property stops position: sticky working on children. I'm unsure why it's being set and haven't observed any changes as a result of removing it.

}

#content {
Expand All @@ -2270,7 +2269,7 @@ div[class*="-table-of-contents-container"] {
padding: 4rem 0 4rem 4rem;
background: #fff;
box-sizing: border-box;
width: $single-handbook-content-primary-width * 100%;
width: 72%;

@media (max-width: 876px) {
padding: 4rem 20px;
Expand Down Expand Up @@ -2458,37 +2457,12 @@ body.responsive-show {

@media (min-width: 90em) {
.site-main .table-of-contents {
position: fixed;
width: 15vw;

.code-reference & {
margin-left: 0;
left: calc( #{ $devhub-wrap-content-width } + ( ( 100vw - #{ $devhub-wrap-content-width } ) / 2 ) );
top: $devhub-wrap-toc-position-top;
max-height: calc(90vh - #{ $devhub-wrap-toc-position-top });
}

// Pages with sidebar
.widget-area + & {
left: calc( #{ $single-handbook-content-width } + ( ( 100vw - #{ $single-handbook-content-width } ) / 2 ) );
top: $single-handbook-toc-position-top;
max-height: calc(90vh - #{ $single-handbook-toc-position-top });
}
}
}

@media (min-width: 877px) {
// Pages which are not code reference and without a sidebar
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was required for local dev, but in production all pages have a sidebar on the left so this code is redundant

.site-main .table-of-contents:not(.code-reference .site-main .table-of-contents):not(.widget-area + .site-main .table-of-contents) {
position: fixed;
width: 15vw;
position: sticky;
width: $single-handbook-toc-width;
margin: 0 calc(-#{ $single-handbook-toc-width } - 30px) 0;
float: right;
top: $single-handbook-toc-position-top;
left: calc(
#{ $single-handbook-content-width } * #{ $single-handbook-content-primary-width }
+ ( ( 100vw - #{ $single-handbook-content-width } ) / 2 )
+ 15px
);
max-height: calc(90vh - #{ $single-handbook-toc-position-top });
max-height: calc(80vh - #{ $single-handbook-toc-position-top });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$single-handbook-content-width: 960px;
$single-handbook-content-primary-width: 0.72;
$single-handbook-toc-position-top: 200px;
$single-handbook-toc-width: 15vw;
$single-handbook-toc-position-top: 150px;

$devhub-wrap-content-width: 60em;
$devhub-wrap-toc-position-top: 210px;
32 changes: 7 additions & 25 deletions source/wp-content/themes/wporg-developer/stylesheets/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.