Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

enable hitting esc to close menu and to close popover

Oleg Isonendd1ae22ff22b
diff --git a/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx b/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx
index 02ca0feb3c..04eb53298c 100644
--- a/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx
@@ -48,6 +48,9 @@ export const ValuePickerPopover = ({
side="right"
hideArrow
align="start"
+ onEscapeKeyDown={() => {
+ setIsOpen(false);
+ }}
>
<PopoverHeader title={title} />
{content}
diff --git a/apps/designer/app/designer/shared/fonts-manager/item-menu.tsx b/apps/designer/app/designer/shared/fonts-manager/item-menu.tsx
index 70052f4c8f..fc0b9c586d 100644
--- a/apps/designer/app/designer/shared/fonts-manager/item-menu.tsx
+++ b/apps/designer/app/designer/shared/fonts-manager/item-menu.tsx
@@ -10,6 +10,7 @@ import {
} from "@webstudio-is/design-system";
import { DotsHorizontalIcon } from "@webstudio-is/icons";
import { cssVars } from "@webstudio-is/css-vars";
+import { useState } from "react";
export const itemMenuVars = {
visibility: cssVars.define("visibility"),
@@ -30,15 +31,26 @@ type ItemMenuProps = {
};
export const ItemMenu = ({ onDelete, onOpenChange }: ItemMenuProps) => {
+ const [isOpen, setIsOpen] = useState(false);
return (
- <DropdownMenu onOpenChange={onOpenChange}>
+ <DropdownMenu
+ open={isOpen}
+ onOpenChange={(open) => {
+ setIsOpen(open);
+ onOpenChange(open);
+ }}
+ >
<DropdownMenuTrigger asChild>
<MenuButton aria-label="Font menu">
<DotsHorizontalIcon />
</MenuButton>
</DropdownMenuTrigger>
<DropdownMenuPortal>
- <DropdownMenuContent>
+ <DropdownMenuContent
+ onEscapeKeyDown={() => {
+ setIsOpen(false);
+ }}
+ >
<DropdownMenuItem
onSelect={() => {
onDelete();