Skip to content

Commit

Permalink
fix: focus outline size
Browse files Browse the repository at this point in the history
Use pseudo-element within button element to fill dead-space below button, preventing menu closure when mouse pauses in this space (while maintaining original button size)
  • Loading branch information
wackerow committed Mar 6, 2024
1 parent 70fee50 commit 48ee6c7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/Nav/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ const Menu = ({ sections, ...props }: NavMenuProps) => {
<NavigationMenu.Item key={sectionKey} value={label}>
<NavigationMenu.Trigger asChild>
<Button
pt="2"
pb={2 + NAV_PY}
py="2"
px={{ base: "3", lg: "4" }}
variant="ghost"
whiteSpace="nowrap"
color={isActive ? "primary.base" : "body.base"}
_after={{
content: '""',
position: "absolute",
insetInline: 0,
top: "100%",
height: NAV_PY,
}}
>
{/* Animated highlight for active section */}
{isActive && (
Expand All @@ -57,7 +63,6 @@ const Menu = ({ sections, ...props }: NavMenuProps) => {
layoutId="active-section-highlight"
position="absolute"
inset="0"
bottom={NAV_PY}
bg="primary.lowContrast"
rounded="base"
zIndex={0}
Expand Down

0 comments on commit 48ee6c7

Please sign in to comment.