Skip to content

Commit 88fa06f

Browse files
committed
fix: put popover on nav element directly, use physical right property
- Move popover attribute onto <nav> itself (eliminates empty wrapper element taking up flex gap space at mobile) - At mobile, only brand + button are visible flex children, so space-between puts button at right edge - Use physical 'right' instead of 'inset-inline-end' for reliable positioning in the top layer
1 parent 1c68194 commit 88fa06f

2 files changed

Lines changed: 24 additions & 26 deletions

File tree

src/design/components/header/index.tsx

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function Header({ config }: { config: SiteConfig }) {
1717
</a>
1818
<button
1919
class="mobile-nav-toggle"
20-
popovertarget="mobile-nav"
20+
popovertarget="primary-nav"
2121
aria-label="Menu"
2222
>
2323
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
@@ -26,25 +26,23 @@ export function Header({ config }: { config: SiteConfig }) {
2626
<line x1="3" y1="18" x2="21" y2="18" />
2727
</svg>
2828
</button>
29-
<nav aria-label="Primary">
30-
<div id="mobile-nav" popover="auto">
31-
<ul>
32-
<li>
33-
<a href={url('/work/', config.basePath)}>Work</a>
34-
</li>
35-
<li>
36-
<a href={url('/commitment/', config.basePath)}>Commitment</a>
37-
</li>
38-
<li>
39-
<a href={url('/about/', config.basePath)}>About</a>
40-
</li>
41-
<li>
42-
<Link href="https://github.com/flexion" external>
43-
GitHub
44-
</Link>
45-
</li>
46-
</ul>
47-
</div>
29+
<nav aria-label="Primary" id="primary-nav" popover="auto">
30+
<ul>
31+
<li>
32+
<a href={url('/work/', config.basePath)}>Work</a>
33+
</li>
34+
<li>
35+
<a href={url('/commitment/', config.basePath)}>Commitment</a>
36+
</li>
37+
<li>
38+
<a href={url('/about/', config.basePath)}>About</a>
39+
</li>
40+
<li>
41+
<Link href="https://github.com/flexion" external>
42+
GitHub
43+
</Link>
44+
</li>
45+
</ul>
4846
</nav>
4947
</header>
5048
)

src/design/layout.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,20 @@
9898
display: none;
9999
}
100100
@media (min-width: 36rem) {
101-
#mobile-nav:not(:popover-open) {
102-
display: contents;
101+
#primary-nav:not(:popover-open) {
102+
display: block;
103103
}
104104
}
105105
@media (max-width: 36rem) {
106106
.mobile-nav-toggle {
107107
display: inline-flex;
108108
}
109109
}
110-
#mobile-nav:popover-open {
110+
#primary-nav:popover-open {
111111
position: fixed;
112112
inset: auto;
113-
inset-block-start: 4rem;
114-
inset-inline-end: var(--space-5);
113+
top: 4rem;
114+
right: var(--space-5);
115115
width: auto;
116116
height: auto;
117117
margin: 0;
@@ -121,7 +121,7 @@
121121
border-radius: var(--radius-md);
122122
box-shadow: var(--shadow-card);
123123
}
124-
#mobile-nav:popover-open ul {
124+
#primary-nav:popover-open ul {
125125
display: flex;
126126
flex-direction: column;
127127
gap: var(--space-3);

0 commit comments

Comments
 (0)