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): Re-focus the tree-node after completion of editing the name (#1945)
Jaya Krishna Namburuea14cb2bd044
diff --git a/apps/builder/app/builder/shared/tree/index.tsx b/apps/builder/app/builder/shared/tree/index.tsxindex bf3760c4f6..5ee06ab54f 100644--- a/apps/builder/app/builder/shared/tree/index.tsx+++ b/apps/builder/app/builder/shared/tree/index.tsx@@ -88,7 +88,7 @@ export const InstanceTree = (const isEditing = props.itemData.id === editingItemId;return (- <TreeItemBody {...props} selectionEvent="focus" isEditing={isEditing}>+ <TreeItemBody {...props} selectionEvent="focus"><TreeItemisEditable={true}isEditing={isEditing}@@ -146,7 +146,13 @@ const TreeItem = ({const { ref, handlers } = useContentEditable({isEditable,isEditing,- onChangeValue,+ onChangeValue: (value: string) => {+ onChangeValue(value);+ const button = ref.current?.closest(+ "[data-item-button-id]"+ ) as HTMLElement;+ button?.focus();+ },onChangeEditing,});diff --git a/packages/design-system/src/components/tree/tree-node.tsx b/packages/design-system/src/components/tree/tree-node.tsxindex f5c9d27ab4..fcac94c039 100644--- a/packages/design-system/src/components/tree/tree-node.tsx+++ b/packages/design-system/src/components/tree/tree-node.tsx@@ -263,14 +263,12 @@ export const TreeItemBody = <Data extends { id: string }>({forceFocus = false,selectionEvent = "click",onToggle,- isEditing = false,}: TreeItemRenderProps<Data> & {children: React.ReactNode;suffix?: React.ReactNode;suffixWidth?: string;alwaysShowSuffix?: boolean;forceFocus?: boolean;- isEditing?: boolean;selectionEvent?: "click" | "focus";}) => {const [focusTarget, setFocusTarget] = useState<