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.

fixes esc press for all radix components

Oleg Isonenb1d2b95ae617
diff --git a/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.ts b/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.ts
index 8849e6a5ad..48e8a2799c 100644
--- a/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.ts
+++ b/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.ts
@@ -3,6 +3,8 @@ import { useBreakpoints } from "~/shared/nano-states";
import { useZoom, useSelectedBreakpoint } from "../../shared/nano-states";
import { minZoom } from "./zoom-setting";
import { utils } from "@webstudio-is/project";
+import { shortcuts } from "~/shared/shortcuts";
+import { useHotkeys } from "react-hotkeys-hook";
export const useSubscribeSelectBreakpointFromShortcut = () => {
const [breakpoints] = useBreakpoints();
@@ -17,6 +19,17 @@ const zoomStep = 20;
export const useSubscribeZoomFromShortcut = () => {
const [zoom, setZoom] = useZoom();
+
+ // We need to prevent browser default behavior for zooming in/out
+ // Maybe we should use shift modifier and keep the default behaivor functional?
+ useHotkeys(
+ shortcuts.zoom,
+ (event) => {
+ event.preventDefault();
+ },
+ []
+ );
+
useSubscribe("zoom", (direction) => {
if (direction === "zoomIn") {
setZoom(Math.min(zoom + zoomStep, 100));
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 1aaa24140f..9fecafec57 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
@@ -53,9 +53,6 @@ export const ValuePickerPopover = ({
side="right"
hideArrow
align="start"
- onEscapeKeyDown={() => {
- handleOpenChange(false);
- }}
css={{ width: PANEL_WIDTH }}
>
<PopoverHeader title={title} />
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 fa2179f611..08e025e365 100644
--- a/apps/designer/app/designer/shared/fonts-manager/item-menu.tsx
+++ b/apps/designer/app/designer/shared/fonts-manager/item-menu.tsx
@@ -49,13 +49,7 @@ export const ItemMenu = ({ onDelete, onOpenChange }: ItemMenuProps) => {
</MenuButton>
</DropdownMenuTrigger>
<DropdownMenuPortal>
- <DropdownMenuContent
- align="start"
- onEscapeKeyDown={() => {
- setIsOpen(false);
- onOpenChange(false);
- }}
- >
+ <DropdownMenuContent align="start">
<DropdownMenuItem
onSelect={() => {
onDelete();
diff --git a/apps/designer/app/designer/shared/shortcuts/use-publish-shortcuts.ts b/apps/designer/app/designer/shared/shortcuts/use-publish-shortcuts.ts
index 8ba8c3da72..9eaf306c1a 100644
--- a/apps/designer/app/designer/shared/shortcuts/use-publish-shortcuts.ts
+++ b/apps/designer/app/designer/shared/shortcuts/use-publish-shortcuts.ts
@@ -20,7 +20,6 @@ export const usePublishShortcuts = (publish: Publish) => {
useHotkeys(
shortcuts[name],
(event) => {
- event.preventDefault();
publish({
type: "shortcut",
payload: { name, key: event.key },