Header dropdowns close after a click; a tint circle behind the side nav
The dropdowns opened on any focus inside, and a click leaves focus on the link, so they stayed open after the pointer left; now only keyboard focus (:focus-visible) opens them besides hover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3308b5f1b5
commit
dc003a5487
2 changed files with 15 additions and 3 deletions
|
|
@ -189,8 +189,12 @@ export default function Layout() {
|
||||||
</NavLink>
|
</NavLink>
|
||||||
{pageSections.length > 0 && (
|
{pageSections.length > 0 && (
|
||||||
// pt-3 is the bridge the pointer crosses from the
|
// pt-3 is the bridge the pointer crosses from the
|
||||||
// link into the menu without it closing.
|
// link into the menu without it closing. Keyboard
|
||||||
<div className="invisible absolute top-full left-0 z-10 pt-3 opacity-0 transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100">
|
// focus opens it too, but only keyboard focus
|
||||||
|
// (:focus-visible): a click leaves focus on the
|
||||||
|
// link, which held the menu open after the
|
||||||
|
// pointer had gone.
|
||||||
|
<div className="invisible absolute top-full left-0 z-10 pt-3 opacity-0 transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-has-[:focus-visible]:visible group-has-[:focus-visible]:opacity-100">
|
||||||
<ul
|
<ul
|
||||||
className="min-w-56 py-2 shadow-xl"
|
className="min-w-56 py-2 shadow-xl"
|
||||||
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid #9cc47c" }}
|
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid #9cc47c" }}
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,16 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
|
||||||
style={{ width: "calc((100% - 72rem) / 2 + 1rem)" }}
|
style={{ width: "calc((100% - 72rem) / 2 + 1rem)" }}
|
||||||
>
|
>
|
||||||
<div className="sticky pt-8 pl-4 pr-2" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
|
<div className="sticky pt-8 pl-4 pr-2" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
|
||||||
|
<div className="relative">
|
||||||
|
{/* A solid circle behind the list, centered on it: the
|
||||||
|
tint, which the nav's text reads on in either mode. */}
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
className="absolute top-1/2 left-1/2 -z-10 aspect-square w-[min(150%,22rem)] -translate-x-1/2 -translate-y-1/2 rounded-full bg-tint"
|
||||||
|
/>
|
||||||
<SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} wrap />
|
<SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} wrap />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
{bands}
|
{bands}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue