Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-44392: Prevent opening/closing GafaelfawrUserMenu on hover. #168

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/many-moles-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lsst-sqre/squared': minor
---

Disable opening and closing the GafaelfawrUserMenu on hover. This is a better UX because it allows for less precise mousing when using the menu.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const Default: Story = {
<SWRConfig value={{ provider: () => new Map() }}>
<GafaelfawrUserMenu {...args}>
<GafaelfawrUserMenu.Link href="#">
Account Settings
Account settings
</GafaelfawrUserMenu.Link>
<GafaelfawrUserMenu.Link href="#">
Security tokens
Expand Down
17 changes: 14 additions & 3 deletions packages/squared/src/components/GafaelfawrUserMenu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,28 @@ export const Menu = ({ children, logoutHref, username }: MenuProps) => {
<MenuRoot>
<MenuList>
<RadixNavigationMenu.Item>
<MenuTrigger>
<MenuTrigger
onPointerMove={(event) => event.preventDefault()}
onPointerEnter={(event) => event.preventDefault()}
onPointerLeave={(event) => event.preventDefault()}
>
{username} <ChevronDown />
</MenuTrigger>
<MenuContent>
<MenuContent
onPointerMove={(event) => event.preventDefault()}
onPointerEnter={(event) => event.preventDefault()}
onPointerLeave={(event) => event.preventDefault()}
>
{children}
<MenuLink href={logoutHref}>Log out</MenuLink>
</MenuContent>
</RadixNavigationMenu.Item>
</MenuList>
<ViewportContainer>
<ContentViewport />
<ContentViewport
onPointerEnter={(event) => event.preventDefault()}
onPointerLeave={(event) => event.preventDefault()}
/>
</ViewportContainer>
</MenuRoot>
);
Expand Down
Loading