Skip to content

Commit

Permalink
fix: remove focus from menu button after click (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndv99 authored Nov 8, 2023
1 parent 3699d74 commit 71b9ff5
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/lib/sections/Navigation/MenuButton/MenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,29 @@ export interface NavigationMenuButtonProps {
onClick: ButtonProps["onClick"];
}

export const MenuButton = ({ children, className, onClick }: NavigationMenuButtonProps) => {

export const MenuButton = ({
children,
className,
onClick,
}: NavigationMenuButtonProps) => {
return (
<Button appearance="base" className={classNames("p-side-navigation__button--menu has-icon is-dark", className)} onClick={onClick}>
<Button
appearance="base"
className={classNames(
"p-side-navigation__button--menu has-icon is-dark",
className,
)}
onClick={(e) => {
if (onClick) {
onClick(e);
}
// Make sure the button does not have focus
// .l-navigation remains open with :focus-within
e.stopPropagation();
e.currentTarget.blur();
}}
>
{children}
</Button>
)
}
);
};

0 comments on commit 71b9ff5

Please sign in to comment.