Skip to content

Commit fbbf0f5

Browse files
authored
fix: Update z-indices to avoid layouting issues (#434)
Update the z-indices according to the following order (lowest to highest): ``` .o-interactive-map__controls (removed z-index, had no effect) .o-dropdown__menu (removed z-index, should inherit from context) .overlay--content .o-aside .overlay--search #search (+ .pagefind-ui__form::before) .o-header .o-header__skip-link .o-header__curtain .o-header__nav--open nav .a-snackbar ``` I took the line number and multiplied it by 2 to give some flexibility to add new indices in between in the future. Resolves #432 Resolves #425 Resolves #406
1 parent 5a8d29f commit fbbf0f5

File tree

9 files changed

+23
-20
lines changed

9 files changed

+23
-20
lines changed

assets/js/contentNavigation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ const initAside = () => {
2020
asideContent.removeAttribute("role");
2121
asideContent.setAttribute("aria-hidden", "true");
2222
handleBtn.setAttribute("aria-expanded", "false");
23-
overlay.classList.remove("overlay--show");
23+
overlay.classList.remove("overlay--show", "overlay--content");
2424
};
2525

2626
const openSheet = () => {
2727
isClosed = false;
2828
aside.classList.add("o-aside--open");
29-
overlay.classList.add("overlay--show");
29+
overlay.classList.add("overlay--show", "overlay--content");
3030
asideContent.setAttribute("role", "dialog");
3131
asideContent.setAttribute("aria-hidden", "false");
3232
handleBtn.setAttribute("aria-expanded", "true");

assets/js/search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ const initSearch = () => {
5050

5151
const closeSearch = () => {
5252
search.querySelector(".pagefind-ui__search-clear").click();
53-
overlay.classList.remove("overlay--show", "overlay--show-lv5");
53+
overlay.classList.remove("overlay--show", "overlay--search");
5454
search.classList.remove("o-search--show");
5555
updateSearchButtonLabels(false);
5656
};
5757

5858
const openSearch = () => {
59-
overlay.classList.add("overlay--show", "overlay--show-lv5");
59+
overlay.classList.add("overlay--show", "overlay--search");
6060
search.classList.add("o-search--show");
6161
searchElement.focus();
6262
search.scrollIntoView({ behavior: "smooth", block: "start" });

assets/sass/anchorlink.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
align-self: flex-start;
8989
margin: 1rem;
9090
text-wrap: balance;
91-
z-index: 1000;
91+
z-index: 22;
9292
}
9393

9494
.a-snackbar--show {

assets/sass/contentNavigation.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
font-size: 1.4rem;
66
line-height: 1.5;
77
margin-right: 0;
8-
z-index: 3;
8+
z-index: 8;
99
display: flex;
1010
flex-direction: column;
1111
gap: 1.5rem;

assets/sass/dropdown.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
margin-bottom: 0;
4444
padding-left: 0;
4545
box-shadow: var(--box-shadow);
46-
z-index: 200;
4746
border: var(--border);
4847

4948
&--above {

assets/sass/interactiveMap.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
display: flex;
2323
flex-direction: column;
2424
gap: 0.5rem;
25-
z-index: 3;
2625

2726
@media print {
2827
display: none;

assets/sass/navigation.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
top: 0;
55
box-shadow: 0 0.4rem 1rem 0 rgba(0, 0, 0, 0.1);
66
background-color: var(--bg-default);
7-
z-index: 7;
7+
z-index: 14;
88
height: 6rem;
99
padding-left: calc((100vw - 100%) / 2);
1010
border-bottom: var(--border);
@@ -30,7 +30,7 @@
3030
background-color: rgba(0, 0, 0, 0.8);
3131
inset: 0;
3232
position: fixed;
33-
z-index: 2;
33+
z-index: 18;
3434
}
3535

3636
.o-header__nav {
@@ -108,7 +108,7 @@ menu > li > menu {
108108
background-color: var(--bg-neutral);
109109
border-radius: var(--border-radius-s);
110110
color: var(--bg-default);
111-
z-index: 100;
111+
z-index: 16;
112112

113113
&:focus {
114114
opacity: 1;
@@ -251,7 +251,7 @@ menu > li > menu {
251251
right: 0;
252252
width: 70%;
253253
height: 100%;
254-
z-index: 4;
254+
z-index: 20;
255255
background-color: var(--bg-default);
256256
padding: 1rem;
257257
overflow-y: scroll;

assets/sass/search.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
$search-z-index: 12;
2+
13
#search {
24
width: 100%;
35
display: flex;
4-
z-index: 6;
6+
z-index: $search-z-index;
57

68
@media print {
79
display: none;
@@ -33,7 +35,7 @@
3335
}
3436

3537
input.pagefind-ui__search-input {
36-
z-index: 6;
38+
z-index: $search-z-index;
3739
outline: 0.2rem solid transparent;
3840
border: var(--border);
3941
box-shadow: var(--box-shadow);
@@ -65,7 +67,7 @@
6567
}
6668

6769
.pagefind-ui__form::before {
68-
z-index: 7;
70+
z-index: $search-z-index + 1;
6971
}
7072

7173
.pagefind-ui__drawer {
@@ -75,7 +77,7 @@
7577
overflow: hidden;
7678
position: absolute;
7779
width: 100%;
78-
z-index: 6;
80+
z-index: $search-z-index;
7981
border: var(--border);
8082
border-radius: 0 0 var(--border-radius-l) var(--border-radius-l);
8183
}
@@ -156,6 +158,6 @@
156158
display: block;
157159
opacity: 1;
158160
visibility: visible;
159-
z-index: 6;
161+
z-index: $search-z-index;
160162
}
161163
}

assets/sass/styles.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,15 +389,18 @@ details > summary {
389389
background-color: rgba(0, 0, 0, 0.6);
390390
position: fixed;
391391
inset: 0;
392-
z-index: 3;
393392

394393
@media print {
395394
display: none;
396395
}
397396
}
398397

399-
.overlay--show-lv5 {
400-
z-index: 5;
398+
.overlay--content {
399+
z-index: 6;
400+
}
401+
402+
.overlay--search {
403+
z-index: 10;
401404
}
402405

403406
body:has(.overlay--show) {

0 commit comments

Comments
 (0)