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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix search cancel button position and behavior
Oleg Isonencf69d1b181aa
diff --git a/packages/design-system/src/components/search-field.tsx b/packages/design-system/src/components/search-field.tsxindex 7830c32370..17d5762f72 100644--- a/packages/design-system/src/components/search-field.tsx+++ b/packages/design-system/src/components/search-field.tsx@@ -20,7 +20,13 @@ const SearchFieldBase: ForwardRefRenderFunction<HTMLInputElement,ComponentProps<typeof TextField> & { onCancel?: () => void }> = (props, ref) => {- const { onChange, onCancel, value: propsValue = "", ...rest } = props;+ const {+ onChange,+ onCancel,+ value: propsValue = "",+ onKeyDown,+ ...rest+ } = props;const [value, setValue] = useState(String(propsValue));const inputRef = useRef<HTMLInputElement>(null);useEffect(() => {@@ -54,6 +60,14 @@ const SearchFieldBase: ForwardRefRenderFunction<setValue(event.target.value);onChange?.(event);}}+ onKeyDown={(event) => {+ // Make sure we clear the search on esc and preserve the default browser behavior+ if (event.key === "Escape" && value.length !== 0) {+ event.stopPropagation();+ return;+ }+ onKeyDown?.(event);+ }}/>);};diff --git a/packages/design-system/src/components/text-field.tsx b/packages/design-system/src/components/text-field.tsxindex 391ad02f2a..6f6574903c 100644--- a/packages/design-system/src/components/text-field.tsx+++ b/packages/design-system/src/components/text-field.tsx@@ -2,7 +2,6 @@ import { mergeRefs } from "@react-aria/utils";import React from "react";import { useFocusWithin } from "@react-aria/interactions";import { css, styled } from "../stitches.config";-import { Flex } from "./flex";import { ChevronLeftIcon } from "@webstudio-is/icons";import { cssVars } from "@webstudio-is/css-vars";@@ -218,7 +217,8 @@ const TextFieldBase = styled("div", {},});-const PrefixSlot = styled(Flex, {+const PrefixSlot = styled("div", {+ display: "flex",alignItems: "center",flexShrink: 0,order: 0,@@ -227,7 +227,8 @@ const PrefixSlot = styled(Flex, {borderRadius: 2,});-const SuffixSlot = styled(Flex, {+const SuffixSlot = styled("div", {+ display: "flex",alignItems: "center",flexShrink: 0,order: 2,