Skip to content

Commit 2150f5c

Browse files
author
JoelCDL
committed
Update headernav popover styles
Add 'anchor-scope' property to subnav, rename 'anchor-name' value, replace 'transition-property' property with 'transition' shorthand property (fixes popover flicker bug), remove unnecessary 'position: absolute' declaration in popover, clarify code comments and their spacing.
1 parent 783c3d7 commit 2150f5c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/css/components/headernav.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,23 @@
2626
display: block;
2727
}
2828

29-
/* Sections: */
29+
/* Nav bar and top sections: */
3030
> ul {
3131
display: flex;
3232
}
3333

3434
> ul > li {
3535
flex: 1 1 auto;
36+
anchor-scope: all;
3637

3738
&:not(:last-child) {
3839
border-inline-end: 1px solid oklch(55% 0 0deg);
3940
}
4041
}
4142

42-
/* Nav bar links: */
43+
/* Nav bar links are anchors for popover panels: */
4344
> ul > li > a {
45+
anchor-name: --headernav-anchor;
4446
padding: var(--space1);
4547
background: linear-gradient(oklch(95% 0 0deg), oklch(88% 0 0deg));
4648
color: oklch(36% 0 0deg);
@@ -55,15 +57,14 @@
5557
}
5658
}
5759

58-
/* Panels: */
59-
60+
/* Popover panels: */
6061
[popover] {
61-
position: absolute;
62+
position-anchor: --headernav-anchor;
6263
top: anchor(bottom);
6364
left: anchor(left);
6465
margin: 0;
65-
transition-property: opacity, display, overlay;
66-
transition-duration: .3s;
66+
transition: opacity, display, overlay;
67+
transition-duration: 0.3s;
6768
transition-behavior: allow-discrete;
6869
border: unset;
6970
opacity: 0;
@@ -89,7 +90,6 @@
8990
}
9091

9192
/* Panel columns (no columns, by default). These are set via 'columns-[#]' classes defined in the top-level menu items within WP Menus: */
92-
9393
> ul > .columns-2 > ul {
9494
column-count: 2;
9595
}
@@ -126,7 +126,7 @@
126126
break-inside: avoid; /* Firefox */
127127
}
128128

129-
/* Panel sub-list links: */
129+
/* Panel sub-list links: */
130130
> ul > li > ul > li > ul > li > a {
131131
text-decoration: none;
132132

0 commit comments

Comments
 (0)