diff --git a/css/components/headernav.css b/css/components/headernav.css index f3dd3ec..23ac5ec 100644 --- a/css/components/headernav.css +++ b/css/components/headernav.css @@ -6,10 +6,9 @@ --headernav-section-padding: var(--space3); --headernav-item-margin: var(--space3); - position: relative; - ul { - all: unset; + margin: unset; + padding: unset; list-style-type: none; li { @@ -60,9 +59,28 @@ } /* Panels: */ + + [popover] { + position-area: block-end span-inline-end; + position-try-fallbacks: flip-inline; + inset: unset; + margin: 0; + transition-property: opacity, display, overlay; + transition-duration: .3s; + transition-behavior: allow-discrete; + border: unset; + opacity: 0; + + &:popover-open { + opacity: 1; + + @starting-style { + opacity: 0; + } + } + } + > ul > li > ul { - display: none; - position: absolute; padding: var(--headernav-section-padding); column-gap: calc(var(--headernav-section-padding) * 2); column-rule: 1px solid oklch(88% 0 0deg); @@ -126,48 +144,13 @@ > ul > li li { margin-block-end: var(--headernav-item-margin); } +} - /**** Panel Toggle ****/ - - /* If c-headernav JS not supported: */ - - &.c-headernav-no-js { - > ul > li:hover > ul { - @media (--min-width2) { - display: block; - z-index: 10; - } - } - - /* If :focus-within not supported. Only primary links accessible via tabkey: */ - - > ul > li a:focus { - @media (--min-width2) { - display: block; - z-index: 10; - } - } - - /* If :focus-within supported. All links accessbile via focus. No toggle state on primary links, so user must tab through every secondary link in each section to reach the next section: */ - - > ul > li:focus-within > ul { - @media (--min-width2) { - display: block; - z-index: 10; - } - } - } - - /* If c-headernav JS supported: */ - - &.c-headernav-js { - /* Primary links disabled via JS and used as a toggle for each section. Hover and focus states handled by JS and set via 'open' class: */ +.c-header ~ * { + filter: blur(0) contrast(1) grayscale(0); + transition: filter 0.5s; +} - li.open ul { - @media (--min-width2) { - display: block; - z-index: 10; - } - } - } +.c-header:has(:popover-open) ~ * { + filter: blur(0.05rem) contrast(90%) grayscale(10%); } diff --git a/elements/3-components/headernav.hbs b/elements/3-components/headernav.hbs index c8a8914..ab60862 100644 --- a/elements/3-components/headernav.hbs +++ b/elements/3-components/headernav.hbs @@ -1,5 +1,5 @@ {{!-- Read notes in component config --}} -