just-the-docs/_sass/layout.scss
Joel Hawksley cffe2f1b29
Add ARIA roles and labels to search, header, logo, mobile menu button, and main content (#1259)
This PR fixes several Axe errors I found while working on https://viewcomponent.org/. I did not see any visual regressions on my deploy, but I'd encourage testing with other sites.

---------

Co-authored-by: Lindsey Wild <35239154+lindseywild@users.noreply.github.com>
2023-05-31 13:35:56 -07:00

217 lines
3.6 KiB
SCSS

// The basic two column layout
.side-bar {
z-index: 0;
display: flex;
flex-wrap: wrap;
background-color: $sidebar-color;
@include mq(md) {
flex-flow: column nowrap;
position: fixed;
width: $nav-width-md;
height: 100%;
border-right: $border $border-color;
align-items: flex-end;
}
@include mq(lg) {
width: calc((100% - #{$nav-width + $content-width}) / 2 + #{$nav-width});
min-width: $nav-width;
}
}
.main {
@include mq(md) {
position: relative;
max-width: $content-width;
margin-left: $nav-width-md;
}
@include mq(lg) {
// stylelint-disable function-name-case
// disable for Max(), we want to use the CSS max() function
margin-left: Max(
#{$nav-width},
calc((100% - #{$nav-width + $content-width}) / 2 + #{$nav-width})
);
// stylelint-enable function-name-case
}
}
.main-content-wrap {
@include container;
padding-top: $gutter-spacing-sm;
padding-bottom: $gutter-spacing-sm;
@include mq(md) {
padding-top: $gutter-spacing;
padding-bottom: $gutter-spacing;
}
}
.main-header {
z-index: 0;
display: none;
background-color: $sidebar-color;
@include mq(md) {
display: flex;
justify-content: space-between;
height: $header-height;
background-color: $body-background-color;
border-bottom: $border $border-color;
}
&.nav-open {
display: block;
@include mq(md) {
display: flex;
}
}
}
.site-nav,
.site-header,
.site-footer {
width: 100%;
@include mq(lg) {
width: $nav-width;
}
}
.site-nav {
display: none;
&.nav-open {
display: block;
}
@include mq(md) {
display: block;
padding-top: $sp-8;
padding-bottom: $gutter-spacing-sm;
overflow-y: auto;
flex: 1 1 auto;
}
}
.site-header {
display: flex;
min-height: $header-height;
align-items: center;
@include mq(md) {
height: $header-height;
max-height: $header-height;
border-bottom: $border $border-color;
}
}
.site-title {
@include container;
flex-grow: 1;
display: flex;
height: 100%;
align-items: center;
padding-top: $sp-3;
padding-bottom: $sp-3;
color: $body-heading-color;
@include fs-6;
@include mq(md) {
padding-top: $sp-2;
padding-bottom: $sp-2;
}
}
@if variable-exists(logo) {
.site-logo {
width: 100%;
height: 100%;
background-image: url($logo);
background-repeat: no-repeat;
background-position: left center;
background-size: contain;
}
}
.site-button {
display: flex;
height: 100%;
padding: $gutter-spacing-sm;
align-items: center;
background-color: transparent;
border: none;
margin: 0;
text-align: inherit;
font: inherit;
border-radius: 0;
appearance: none;
}
@include mq(md) {
.site-header .site-button {
display: none;
}
}
.site-title:hover {
background-image: linear-gradient(
-90deg,
rgba($feedback-color, 1) 0%,
rgba($feedback-color, 0.8) 80%,
rgba($feedback-color, 0) 100%
);
}
.site-button:hover {
background-image: linear-gradient(
-90deg,
rgba($feedback-color, 1) 0%,
rgba($feedback-color, 0.8) 100%
);
}
// stylelint-disable selector-max-type
body {
position: relative;
padding-bottom: $sp-10;
overflow-y: scroll;
@include mq(md) {
position: static;
padding-bottom: 0;
}
}
// stylelint-enable selector-max-type
.site-footer {
@include container;
position: absolute;
bottom: 0;
left: 0;
padding-top: $sp-4;
padding-bottom: $sp-4;
color: $grey-dk-000;
@include fs-2;
@include mq(md) {
position: static;
justify-self: end;
}
}
.icon {
width: $sp-5;
height: $sp-5;
color: $link-color;
}