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: Align Form Action add button with panel headers (#6541)
Oleg Isonen3f18f444565f
diff --git a/apps/builder/app/builder/features/settings-panel/content-database-diagnostics.tsx b/apps/builder/app/builder/features/settings-panel/content-database-diagnostics.tsxindex e7df9c35f8..272216d85a 100644--- a/apps/builder/app/builder/features/settings-panel/content-database-diagnostics.tsx+++ b/apps/builder/app/builder/features/settings-panel/content-database-diagnostics.tsx@@ -1,10 +1,12 @@import type { AssetQueryPreviewDiagnostics } from "@webstudio-is/content-engine";import {+ Flex,PanelBanner,SectionTitle,SectionTitleButton,SectionTitleLabel,Text,+ theme,} from "@webstudio-is/design-system";import { CopyIcon } from "@webstudio-is/icons";import type { ReactNode } from "react";@@ -137,6 +139,7 @@ const DiagnosticsSection = ({const [open, setOpen] = useOpenState(label, isOpen);return (<CollapsibleSectionRoot+ fullWidthisOpen={open}onOpenChange={setOpen}trigger={@@ -160,7 +163,13 @@ const DiagnosticsSection = ({</SectionTitle>}>- {children}+ <Flex+ direction="column"+ gap="2"+ css={{ paddingInline: theme.panel.paddingInline }}+ >+ {children}+ </Flex></CollapsibleSectionRoot>);};diff --git a/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsx b/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsxindex 6729ee137e..ae0c1a321a 100644--- a/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsx+++ b/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsx@@ -105,7 +105,9 @@ const setup = (resourceNames: readonly string[]) => {};act(() => root?.render(<Harness />));const addButton = () =>- container.querySelector<HTMLButtonElement>('[aria-label="Add action"]')!;+ container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!;const add = async (name: string) => {await act(async () => userEvent.click(addButton()));const option = Array.from(diff --git a/apps/builder/app/builder/features/settings-panel/controls/form-action.integration.test.tsx b/apps/builder/app/builder/features/settings-panel/controls/form-action.integration.test.tsxindex f18e4a865e..ad8c763f63 100644--- a/apps/builder/app/builder/features/settings-panel/controls/form-action.integration.test.tsx+++ b/apps/builder/app/builder/features/settings-panel/controls/form-action.integration.test.tsx@@ -149,7 +149,9 @@ test("Actions references an existing Resource without creating another", async (expect(container.textContent).not.toContain("Create Resource in Form");await act(async () => {await userEvent.click(- container.querySelector<HTMLButtonElement>('[aria-label="Add action"]')!+ container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!);});const action = Array.from(diff --git a/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsx b/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsxindex e92e1bd605..b3e8fe2f0c 100644--- a/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsx+++ b/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsx@@ -3,10 +3,14 @@ import { act } from "react-dom/test-utils";import { userEvent } from "@vitest/browser/context";import { afterEach, expect, test, vi } from "vitest";import {+ Box,+ Flex,+ Grid,SectionTitle,SectionTitleButton,SectionTitleLabel,TooltipProvider,+ theme,} from "@webstudio-is/design-system";import { PlusIcon } from "@webstudio-is/icons";import type { Prop } from "@webstudio-is/sdk";@@ -16,6 +20,7 @@ import {$props,$resources,} from "~/shared/sync/data-stores";+import { CollapsibleSectionWithAddButton } from "~/builder/shared/collapsible-section";import { FormActionControl } from "./form-action";(@@ -83,12 +88,13 @@ test("Action + explains how to add a resource when none are available", async ()));- const addButton = container.querySelector<HTMLButtonElement>(- '[aria-label="Add action"]'- )!;+ const addButton = container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!;expect(addButton.disabled).toBe(false);expect(addButton.dataset.buttonColor).toBe("ghost");await act(async () => userEvent.click(addButton));+ expect(document.querySelectorAll('[role="tooltip"]')).toHaveLength(1);expect(document.querySelector('[role="tooltip"]')?.textContent).toContain("Create a resource in the Variables section first.");@@ -96,7 +102,7 @@ test("Action + explains how to add a resource when none are available", async ()expect(onChange).not.toHaveBeenCalled();});-test("Action + matches the Variables + button in every interaction state", async () => {+test("Action header and menu align while items sit below the full header", async () => {$instances.set(new Map([[@@ -105,47 +111,155 @@ test("Action + matches the Variables + button in every interaction state", async],]));- $dataSources.set(new Map());- $resources.set(new Map());+ $dataSources.set(+ new Map([+ [+ "send",+ {+ type: "resource",+ id: "send",+ name: "Send request",+ scopeInstanceId: "form",+ resourceId: "request",+ },+ ],+ ])+ );+ $resources.set(new Map([["request", requestResource("request")]]));const container = document.createElement("div");+ container.style.width = "300px";document.body.appendChild(container);root = createRoot(container);await act(async () =>root?.render(<TooltipProvider>- <SectionTitle- suffix={- <SectionTitleButton- aria-label="Add variable"- prefix={<PlusIcon />}- />- }- >- <SectionTitleLabel>Variables</SectionTitleLabel>- </SectionTitle>- <FormActionControl- instanceId="form"- propName="action"- prop={undefined}- computedValue={undefined}- meta={{ type: "json", control: "form-action", required: false }}- onChange={vi.fn()}- />+ <div data-properties-section>+ <CollapsibleSectionWithAddButton+ label="Properties & attributes"+ fullWidth+ onAdd={vi.fn()}+ >+ <Box+ data-properties-content+ css={{ paddingInline: theme.panel.paddingInline }}+ >+ Property content+ </Box>+ </CollapsibleSectionWithAddButton>+ </div>+ <Grid css={{ paddingBottom: theme.panel.paddingBlock }}>+ <FormActionControl+ instanceId="form"+ propName="action"+ prop={{+ id: "action",+ instanceId: "form",+ name: "action",+ type: "json",+ value: [{ dataSourceId: "send" }],+ }}+ computedValue={[{ dataSourceId: "send" }]}+ meta={{ type: "json", control: "form-action", required: false }}+ onChange={vi.fn()}+ />+ </Grid>+ <div data-variables-section>+ <SectionTitle+ suffix={+ <Flex align="center">+ <SectionTitleButton+ aria-label="Add variable"+ prefix={<PlusIcon />}+ />+ </Flex>+ }+ >+ <SectionTitleLabel>Variables</SectionTitleLabel>+ </SectionTitle>+ </div></TooltipProvider>));- const variableButton = Array.from(- container.querySelectorAll<HTMLButtonElement>('[aria-label="Add variable"]')- ).at(-1)!;- const actionButton = container.querySelector<HTMLButtonElement>(- '[aria-label="Add action"]'+ const propertyContent = container.querySelector<HTMLElement>(+ "[data-properties-content]")!;+ expect(+ getComputedStyle(propertyContent.parentElement!).paddingInlineStart+ ).toBe("0px");+ expect(getComputedStyle(propertyContent).paddingInlineStart).toBe("12px");++ const propertyButton = container+ .querySelector("[data-properties-section]")!+ .querySelectorAll<HTMLButtonElement>('[data-button-color="ghost"]')+ .item(1)!;+ const actionButton = container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!;+ const variableButton = container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add variable"]')+ .item(1)!;expect(actionButton.tabIndex).toBe(0);+ const propertyHeader = propertyButton.closest("div[data-state]")!;+ const actionHeader = actionButton+ .closest("div[data-state]")!+ .parentElement!.closest("div[data-state]")!;+ const variableHeader = variableButton.closest("div[data-state]")!;+ const panelRect = container.getBoundingClientRect();+ const propertyRect = propertyHeader.getBoundingClientRect();+ const actionRect = actionHeader.getBoundingClientRect();+ const variableRect = variableHeader.getBoundingClientRect();+ expect(actionRect.left).toBe(propertyRect.left);+ expect(actionRect.right).toBe(propertyRect.right);+ expect(actionRect.left).toBe(variableRect.left);+ expect(actionRect.right).toBe(variableRect.right);+ expect(actionButton.getBoundingClientRect().top - actionRect.top).toBe(+ propertyButton.getBoundingClientRect().top - propertyRect.top+ );+ expect(actionButton.getBoundingClientRect().top - actionRect.top).toBe(+ variableButton.getBoundingClientRect().top - variableRect.top+ );+ const actionButtonRect = actionButton.getBoundingClientRect();+ const propertyButtonRect = propertyButton.getBoundingClientRect();+ expect(+ actionButtonRect.top + actionButtonRect.height / 2 - actionRect.top+ ).toBe(+ propertyButtonRect.top + propertyButtonRect.height / 2 - propertyRect.top+ );+ expect(actionButton.getBoundingClientRect().right - actionRect.right).toBe(+ propertyButton.getBoundingClientRect().right - propertyRect.right+ );+ expect(actionButton.getBoundingClientRect().right - actionRect.right).toBe(+ variableButton.getBoundingClientRect().right - variableRect.right+ );+ const rowRect = container+ .querySelector<HTMLElement>('[data-list-item="true"]')!+ .getBoundingClientRect();+ expect(actionRect.left).toBe(panelRect.left);+ expect(actionRect.right).toBe(panelRect.right);+ expect(rowRect.left).toBe(panelRect.left);+ expect(rowRect.right).toBe(panelRect.right);+ expect(actionRect.height).toBe(36);+ expect(rowRect.top - actionRect.bottom).toBe(2);+ expect(rowRect.top).toBeGreaterThan(actionButtonRect.bottom);+ expect(rowRect.height).toBe(24);+ expect(+ document+ .elementFromPoint(+ rowRect.left + rowRect.width / 2,+ rowRect.top + rowRect.height / 8+ )+ ?.closest('[data-list-item="true"]')+ ).toBe(container.querySelector('[data-list-item="true"]'));+ expect(+ document+ .elementFromPoint(actionButtonRect.left + 2, actionButtonRect.bottom - 1)+ ?.closest('[aria-label="Add action"]')+ ).toBe(actionButton);for (const state of ["auto", "hover", "focus", "pressed"]) {- variableButton.dataset.state = state;+ propertyButton.dataset.state = state;actionButton.dataset.state = state;- const reference = getComputedStyle(variableButton);+ const reference = getComputedStyle(propertyButton);const actual = getComputedStyle(actionButton);for (const property of ["backgroundColor",@@ -164,6 +278,23 @@ test("Action + matches the Variables + button in every interaction state", async);}}+ await act(async () => userEvent.click(actionButton));+ const menuRect = document+ .querySelector<HTMLElement>('[role="menu"]')!+ .getBoundingClientRect();+ const triggerRect = actionButton.getBoundingClientRect();+ expect(menuRect.top).toBeGreaterThanOrEqual(triggerRect.bottom);+ expect(menuRect.right).toBeLessThanOrEqual(panelRect.right);+ expect(menuRect.left).toBeGreaterThanOrEqual(panelRect.left);+ expect(menuRect.right).toBeCloseTo(triggerRect.right, 0);+ await act(async () => userEvent.keyboard("{Escape}"));+ const actionLabel = Array.from(container.querySelectorAll("button")).find(+ (button) => button.textContent === "Action"+ )!;+ await act(async () => userEvent.click(actionLabel));+ expect(document.querySelector('[role="tooltip"]')?.textContent).toContain(+ "Sends each form submission to all destinations at the same time."+ );});test("Action control handles an empty Resource list and can select an in-scope destination", async () => {@@ -263,9 +394,9 @@ test("Action control handles an empty Resource list and can select an in-scope d"Create a Resource in Data variables to add an action.");- const addButton = container.querySelector<HTMLButtonElement>(- '[aria-label="Add action"]'- )!;+ const addButton = container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!;expect(addButton.dataset.buttonColor).toBe("ghost");await act(async () =>@@ -283,7 +414,7 @@ test("Action control handles an empty Resource list and can select an in-scope dawait act(async () => userEvent.click(addButton));expect(getComputedStyle(document.querySelector('[role="menu"]')!).minWidth- ).toBe("180px");+ ).toBe("176px");const requestOption = Array.from(document.querySelectorAll<HTMLElement>('[role="menuitem"]')).find((option) => option.textContent?.includes("Go"));@@ -345,8 +476,9 @@ test("Action control handles an empty Resource list and can select an in-scope d);expect(container.textContent).not.toContain("Create Resource in Form");expect(- container.querySelector<HTMLButtonElement>('[aria-label="Add action"]')- ?.disabled+ container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)?.disabled).toBe(true);});@@ -415,7 +547,9 @@ test("a Form can select a Resource defined outside its scope", async () => {await act(async () =>userEvent.click(- container.querySelector<HTMLButtonElement>('[aria-label="Add action"]')!+ container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!));const requestOption = Array.from(@@ -599,9 +733,9 @@ test("Actions only offers eligible in-scope Resources and disables an added one"));expect(document.querySelector('[role="dialog"]')).toBeNull();- const addButton = container.querySelector<HTMLButtonElement>(- '[aria-label="Add action"]'- )!;+ const addButton = container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!;await act(async () => await userEvent.hover(addButton));await expect.poll(() => document.querySelector('[role="tooltip"]')?.textContent)@@ -710,12 +844,15 @@ test("a legacy Action stays visible and can be removed", async () => {expect(row?.getClientRects().length).toBeGreaterThan(0);expect(getComputedStyle(row!).opacity).toBe("1");expect(row?.hasAttribute("disabled")).toBe(false);- expect(row?.parentElement?.getBoundingClientRect().left).toBeLessThan(+ expect(row?.getBoundingClientRect().left).toBe(container.getBoundingClientRect().left);- const addButton = container.querySelector<HTMLButtonElement>(- '[aria-label="Add action"]'- )!;+ expect(row?.getBoundingClientRect().right).toBe(+ container.getBoundingClientRect().right+ );+ const addButton = container+ .querySelectorAll<HTMLButtonElement>('[aria-label="Add action"]')+ .item(1)!;await act(async () => addButton.focus());await act(async () => userEvent.tab());expect(document.activeElement).toBe(row);diff --git a/apps/builder/app/builder/features/settings-panel/controls/form-action.tsx b/apps/builder/app/builder/features/settings-panel/controls/form-action.tsxindex 2a3ad2147c..5925918fea 100644--- a/apps/builder/app/builder/features/settings-panel/controls/form-action.tsx+++ b/apps/builder/app/builder/features/settings-panel/controls/form-action.tsx@@ -10,6 +10,7 @@ import {DropdownMenuTrigger,Flex,Grid,+ SectionTitle,SectionTitleButton,SmallIconButton,Text,@@ -141,112 +142,121 @@ export const FormActionControl = ({: validateFormSubmission(action);return (- <Box>- <Flex align="center" justify="between">- <FieldLabel- description={- <Flex direction="column" gap="1">- <Text>- Sends each form submission to all destinations at the same time.- </Text>- <Box as="ul" css={{ margin: 0, paddingLeft: theme.spacing[4] }}>- <li>- <Text>- <code>formData</code> — submitted fields from this Form- </Text>- </li>- <li>- <Text>- <code>browserInfo</code> — visitor details- </Text>- </li>- <li>- <Text>- <code>formState</code> — current Form state: initial,- success, or error.- </Text>- </li>- <li>- <Text>- <code>results</code> — each action’s response, in order- </Text>- </li>- <li>- <Text>- <code>errors</code> — failed actions and their messages- </Text>- </li>- </Box>- </Flex>- }- resettable={invalidSavedValue || action.length > 0}- resetLabel="Reset"- onReset={() => update([])}- >- Action- </FieldLabel>- {resources.length === 0 ? (- <Tooltip- content="Create a resource in the Variables section first."- open={showEmptyResourceTooltip}- onOpenChange={setShowEmptyResourceTooltip}- >- <SectionTitleButton- aria-label="Add action"- tabIndex={0}- prefix={<PlusIcon />}- onClick={() => setShowEmptyResourceTooltip(true)}- />- </Tooltip>- ) : (- <DropdownMenu>- <Tooltip content="Add a resource to submit this Form.">- <span style={{ display: "flex" }}>- <DropdownMenuTrigger asChild>- <SectionTitleButton- aria-label="Add action"- tabIndex={0}- disabled={action.length >= maxFormActions}- prefix={<PlusIcon />}- />- </DropdownMenuTrigger>- </span>+ <Grid css={{ paddingInline: 0 }}>+ <SectionTitle+ collapsible={false}+ suffixPlaceholder={+ <SectionTitleButton aria-label="Add action" prefix={<PlusIcon />} />+ }+ suffix={+ resources.length === 0 ? (+ <Tooltip+ content="Create a resource in the Variables section first."+ open={showEmptyResourceTooltip}+ onOpenChange={setShowEmptyResourceTooltip}+ >+ <SectionTitleButton+ aria-label="Add action"+ tabIndex={0}+ prefix={<PlusIcon />}+ onClick={() => setShowEmptyResourceTooltip(true)}+ /></Tooltip>- <DropdownMenuContent css={{ minWidth: 180 }}>- {resources.map((variable) => (- <DropdownMenuItem- key={variable.id}- disabled={action.some(- ({ dataSourceId }) => dataSourceId === variable.id- )}- onSelect={() => {- if (- action.length < maxFormActions &&- !action.some(- ({ dataSourceId }) => dataSourceId === variable.id- )- ) {- update([...action, { dataSourceId: variable.id }]);- }- }}- >- {variable.name}- </DropdownMenuItem>- ))}- </DropdownMenuContent>- </DropdownMenu>- )}- </Flex>+ ) : (+ <DropdownMenu>+ <Tooltip content="Add a resource to submit this Form.">+ <Flex>+ <DropdownMenuTrigger asChild>+ <SectionTitleButton+ aria-label="Add action"+ tabIndex={0}+ disabled={action.length >= maxFormActions}+ prefix={<PlusIcon />}+ />+ </DropdownMenuTrigger>+ </Flex>+ </Tooltip>+ <DropdownMenuContent+ align="end"+ collisionPadding={16}+ css={{ minWidth: theme.spacing[26] }}+ >+ {resources.map((variable) => (+ <DropdownMenuItem+ key={variable.id}+ disabled={action.some(+ ({ dataSourceId }) => dataSourceId === variable.id+ )}+ onSelect={() => {+ if (+ action.length < maxFormActions &&+ !action.some(+ ({ dataSourceId }) => dataSourceId === variable.id+ )+ ) {+ update([...action, { dataSourceId: variable.id }]);+ }+ }}+ >+ {variable.name}+ </DropdownMenuItem>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ )+ }+ >+ <Box css={{ pointerEvents: "auto" }}>+ <FieldLabel+ description={+ <Flex direction="column" gap="1">+ <Text>+ Sends each form submission to all destinations at the same+ time.+ </Text>+ <Box as="ul" css={{ margin: 0, paddingLeft: theme.spacing[4] }}>+ <li>+ <Text>+ <code>formData</code> — submitted fields from this Form+ </Text>+ </li>+ <li>+ <Text>+ <code>browserInfo</code> — visitor details+ </Text>+ </li>+ <li>+ <Text>+ <code>formState</code> — current Form state: initial,+ success, or error.+ </Text>+ </li>+ <li>+ <Text>+ <code>results</code> — each action’s response, in order+ </Text>+ </li>+ <li>+ <Text>+ <code>errors</code> — failed actions and their messages+ </Text>+ </li>+ </Box>+ </Flex>+ }+ resettable={invalidSavedValue || action.length > 0}+ resetLabel="Reset"+ onReset={() => update([])}+ >+ Action+ </FieldLabel>+ </Box>+ </SectionTitle><Box css={{ py: theme.spacing[2] }}><Flex direction="column" gap="2">{action.length > 0 && (<InteractiveListArrowFocus dragItemId={dragItemId}>- <Grid- ref={sortableRefCallback}- css={{- marginInline: `calc(-1 * ${theme.panel.paddingInline})`,- }}- >+ <Grid ref={sortableRefCallback}>{action.map(({ dataSourceId: id }, index) => (<ActionItemkey={id}@@ -263,12 +273,23 @@ export const FormActionControl = ({</Grid></InteractiveListArrowFocus>)}- {error && <Text>{error}</Text>}+ {error && (+ <Box css={{ paddingInline: theme.panel.paddingInline }}>+ <Text>{error}</Text>+ </Box>+ )}{action.length > 0 && successRedirect && (- <UrlControl {...successRedirect} />+ <Box css={{ paddingInline: theme.panel.paddingInline }}>+ <UrlControl {...successRedirect} />+ </Box>)}{!invalidSavedValue && action.length === 0 && (- <Flex align="center" justify="center" gap="1">+ <Flex+ align="center"+ justify="center"+ gap="1"+ css={{ paddingInline: theme.panel.paddingInline }}+ ><Text>Navigation mode</Text><InfoTooltiplabel="About navigation mode"@@ -278,6 +299,6 @@ export const FormActionControl = ({)}</Flex></Box>- </Box>+ </Grid>);};diff --git a/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsx b/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsxindex 84e747d984..e7d61ce79e 100644--- a/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsx+++ b/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsx@@ -220,11 +220,12 @@ const renderProperty = (const { prop, propName, meta } = item;if (component === blockComponent && propName === contentBlockSourceProp) {return (- <ContentBlockSourceSection- key={propName}- blockInstanceId={instanceId}- renderScope={selectedInstanceKey}- />+ <Box key={propName} css={{ paddingInline: theme.panel.paddingInline }}>+ <ContentBlockSourceSection+ blockInstanceId={instanceId}+ renderScope={selectedInstanceKey}+ />+ </Box>);}const targetInstanceId = item.instanceId ?? instanceId;@@ -267,7 +268,7 @@ const renderProperty = ();}- return renderControl({+ const control = renderControl({key: propName,instanceId: targetInstanceId,meta,@@ -296,6 +297,11 @@ const renderProperty = (}},});+ return control === undefined ? undefined : (+ <Box key={propName} css={{ paddingInline: theme.panel.paddingInline }}>+ {control}+ </Box>+ );};const forbiddenProperties = new Set(["style"]);@@ -470,31 +476,27 @@ export const PropsSection = (props: PropsSectionProps) => {paddingBottom: theme.panel.paddingBlock,}}>- {logic.systemProps.map((item) => (- <Box- key={item.propName}- css={{ paddingInline: theme.panel.paddingInline }}- >- {renderProperty(props, item)}- </Box>- ))}+ {logic.systemProps.map((item) => renderProperty(props, item))}</Grid><Separator />{showPropertiesSection && (<CollapsibleSectionWithAddButtonlabel="Properties & attributes"+ fullWidthonAdd={isDesignMode ? () => setAddingProp(true) : undefined}hasItems={hasItems}><Flex gap="1" direction="column">{isDesignMode && addingProp && (- <AddPropertyOrAttribute- onPropSelected={(propName) => {- setAddingProp(false);- logic.handleAdd(propName);- }}- />+ <Box css={{ paddingInline: theme.panel.paddingInline }}>+ <AddPropertyOrAttribute+ onPropSelected={(propName) => {+ setAddingProp(false);+ logic.handleAdd(propName);+ }}+ />+ </Box>)}{addedProps.map((item) => renderProperty(props, item))}{getStandaloneInitialProps({diff --git a/apps/builder/app/builder/features/style-panel/sections/borders/borders.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/borders.tsxindex 7cad376ecd..f5e5f24469 100644--- a/apps/builder/app/builder/features/style-panel/sections/borders/borders.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/borders/borders.tsx@@ -1,3 +1,4 @@+import { Flex, theme } from "@webstudio-is/design-system";import type { CssProperty } from "@webstudio-is/css-engine";import { StyleSection } from "../../shared/style-section";import {@@ -27,10 +28,16 @@ export const properties = [export const Section = () => {return (<StyleSection label="Borders" properties={properties}>- <BorderStyle />- <BorderColor />- <BorderWidth />- <BorderRadius />+ <Flex+ direction="column"+ gap="2"+ css={{ paddingInline: theme.panel.paddingInline }}+ >+ <BorderStyle />+ <BorderColor />+ <BorderWidth />+ <BorderRadius />+ </Flex></StyleSection>);};diff --git a/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsxindex a0178443df..d8ead330a3 100644--- a/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx@@ -64,7 +64,13 @@ export const Section = () => {)}>- <Flex css={{ flexDirection: "column", gap: theme.spacing[5] }}>+ <Flex+ css={{+ paddingInline: theme.panel.paddingInline,+ flexDirection: "column",+ gap: theme.spacing[5],+ }}+ ><FlexChildSectionAlign /><FlexChildSectionSizing /><OrderControl />diff --git a/apps/builder/app/builder/features/style-panel/sections/grid-child/grid-child.tsx b/apps/builder/app/builder/features/style-panel/sections/grid-child/grid-child.tsxindex 7b7ccbdb30..be1bc1bc39 100644--- a/apps/builder/app/builder/features/style-panel/sections/grid-child/grid-child.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/grid-child/grid-child.tsx@@ -238,16 +238,22 @@ export const Section = () => {)}>- <GridChildGuides />- <Flex css={{ flexDirection: "column", gap: theme.spacing[5] }}>- <GridChildPositionMode- value={positionMode}- onChange={handleModeChange}- />- {positionMode === "auto" && <GridChildPositionAuto />}- {positionMode === "area" && <GridChildPositionArea />}- {positionMode === "manual" && <GridChildPositionManual />}- <GridChildAlign />+ <Flex+ direction="column"+ gap="2"+ css={{ paddingInline: theme.panel.paddingInline }}+ >+ <GridChildGuides />+ <Flex css={{ flexDirection: "column", gap: theme.spacing[5] }}>+ <GridChildPositionMode+ value={positionMode}+ onChange={handleModeChange}+ />+ {positionMode === "auto" && <GridChildPositionAuto />}+ {positionMode === "area" && <GridChildPositionArea />}+ {positionMode === "manual" && <GridChildPositionManual />}+ <GridChildAlign />+ </Flex></Flex></StyleSection>);diff --git a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsxindex 7c547e919c..6417e2ee82 100644--- a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx@@ -816,7 +816,11 @@ export const Section = () => {return (<StyleSection label="Layout" properties={properties}>- <Flex direction="column" gap="2">+ <Flex+ direction="column"+ gap="2"+ css={{ paddingInline: theme.panel.paddingInline }}+ ><Gridcss={{gridTemplateColumns: `1fr 2fr`,diff --git a/apps/builder/app/builder/features/style-panel/sections/list-item.tsx b/apps/builder/app/builder/features/style-panel/sections/list-item.tsxindex b515040864..e99b23cb6e 100644--- a/apps/builder/app/builder/features/style-panel/sections/list-item.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/list-item.tsx@@ -10,7 +10,13 @@ export const properties = ["list-style-type"] satisfies CssProperty[];export const Section = () => {return (<StyleSection label="List item" properties={properties}>- <Grid gap={2} css={{ gridTemplateColumns: `1fr ${theme.spacing[21]}` }}>+ <Grid+ gap={2}+ css={{+ paddingInline: theme.panel.paddingInline,+ gridTemplateColumns: `1fr ${theme.spacing[21]}`,+ }}+ ><PropertyLabellabel="List style type"description={propertyDescriptions.listStyleType}diff --git a/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsx b/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsxindex c055b0bfe5..04fe02ecab 100644--- a/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsx@@ -28,6 +28,7 @@ export const Section = () => {<StyleSection label="Outline" properties={properties}><Gridcss={{+ paddingInline: theme.panel.paddingInline,gridTemplateColumns: `1fr ${theme.spacing[22]}`,}}gap={2}diff --git a/apps/builder/app/builder/features/style-panel/sections/position/position.tsx b/apps/builder/app/builder/features/style-panel/sections/position/position.tsxindex 132ec3e643..006d58461c 100644--- a/apps/builder/app/builder/features/style-panel/sections/position/position.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/position/position.tsx@@ -39,7 +39,7 @@ export const Section = () => {return (<StyleSection label="Position" properties={properties}>- <Grid gap={2}>+ <Grid gap={2} css={{ paddingInline: theme.panel.paddingInline }}><Grid gap={2} css={{ gridTemplateColumns: `1fr ${theme.spacing[23]}` }}><PropertyLabellabel="Position"diff --git a/apps/builder/app/builder/features/style-panel/sections/size/size.tsx b/apps/builder/app/builder/features/style-panel/sections/size/size.tsxindex 027c0a8883..bc9d72fdc6 100644--- a/apps/builder/app/builder/features/style-panel/sections/size/size.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/size/size.tsx@@ -95,67 +95,69 @@ const SectionLayout = styled(Grid, {export const Section = () => {return (- <StyleSection label="Size" properties={properties} fullWidth>- <SectionLayout columns={2}>- <SizeProperty property="width" />- <SizeProperty property="height" />- <SizeProperty property="min-width" />- <SizeProperty property="min-height" />- <SizeProperty property="max-width" />- <SizeProperty property="max-height" />- <PropertyLabel- label="Aspect ratio"- description={propertyDescriptions.aspectRatio}- properties={["aspect-ratio"]}- />- <TextControl property="aspect-ratio" />- </SectionLayout>- <Separator />- <SectionLayout columns={2}>- <PropertyLabel- label="Overflow"- description={propertyDescriptions.overflow}- properties={["overflow-x", "overflow-y"]}- />- <ToggleGroupControl- label="Overflow"- properties={["overflow-x", "overflow-y"]}- items={[- {- child: <EyeOpenIcon />,- description: propertyDescriptions["overflowX:visible"],- value: "visible",- },- {- child: <CropIcon />,- description: propertyDescriptions["overflowX:clip"],- value: "clip",- },- {- child: <EyeClosedIcon />,- description: propertyDescriptions["overflowX:hidden"],- value: "hidden",- },- {- child: <AutoScrollIcon />,- description: propertyDescriptions["overflowX:auto"],- value: "auto",- },- ]}- />- <PropertyLabel- label="Object fit"- description={propertyDescriptions.objectFit}- properties={["object-fit"]}- />- <SelectControl property="object-fit" />- <PropertyLabel- label="Object position"- description={propertyDescriptions.objectPosition}- properties={["object-position"]}- />- <ObjectPosition />- </SectionLayout>+ <StyleSection label="Size" properties={properties}>+ <Flex direction="column" gap="2" css={{ paddingInline: 0 }}>+ <SectionLayout columns={2}>+ <SizeProperty property="width" />+ <SizeProperty property="height" />+ <SizeProperty property="min-width" />+ <SizeProperty property="min-height" />+ <SizeProperty property="max-width" />+ <SizeProperty property="max-height" />+ <PropertyLabel+ label="Aspect ratio"+ description={propertyDescriptions.aspectRatio}+ properties={["aspect-ratio"]}+ />+ <TextControl property="aspect-ratio" />+ </SectionLayout>+ <Separator />+ <SectionLayout columns={2}>+ <PropertyLabel+ label="Overflow"+ description={propertyDescriptions.overflow}+ properties={["overflow-x", "overflow-y"]}+ />+ <ToggleGroupControl+ label="Overflow"+ properties={["overflow-x", "overflow-y"]}+ items={[+ {+ child: <EyeOpenIcon />,+ description: propertyDescriptions["overflowX:visible"],+ value: "visible",+ },+ {+ child: <CropIcon />,+ description: propertyDescriptions["overflowX:clip"],+ value: "clip",+ },+ {+ child: <EyeClosedIcon />,+ description: propertyDescriptions["overflowX:hidden"],+ value: "hidden",+ },+ {+ child: <AutoScrollIcon />,+ description: propertyDescriptions["overflowX:auto"],+ value: "auto",+ },+ ]}+ />+ <PropertyLabel+ label="Object fit"+ description={propertyDescriptions.objectFit}+ properties={["object-fit"]}+ />+ <SelectControl property="object-fit" />+ <PropertyLabel+ label="Object position"+ description={propertyDescriptions.objectPosition}+ properties={["object-position"]}+ />+ <ObjectPosition />+ </SectionLayout>+ </Flex></StyleSection>);};diff --git a/apps/builder/app/builder/features/style-panel/sections/space/space.tsx b/apps/builder/app/builder/features/style-panel/sections/space/space.tsxindex 41049ce2a9..4f47340bdd 100644--- a/apps/builder/app/builder/features/style-panel/sections/space/space.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/space/space.tsx@@ -1,3 +1,4 @@+import { Flex, theme } from "@webstudio-is/design-system";import { useState, useRef } from "react";import type { CssProperty } from "@webstudio-is/css-engine";import { SpaceLayout } from "./layout";@@ -212,70 +213,79 @@ export const Section = () => {return (<StyleSection label="Space" properties={spaceProperties}>- <SpaceLayout- disabled={readonly}- ref={layoutRef}- onClick={(event) => {- const property = hoverTarget?.property;- const styleValueSource = styles.find(- (styleDecl) => styleDecl.property === property- )?.source.name;+ <Flex+ direction="column"+ gap="2"+ css={{ paddingInline: theme.panel.paddingInline }}+ >+ <SpaceLayout+ disabled={readonly}+ ref={layoutRef}+ onClick={(event) => {+ const property = hoverTarget?.property;+ const styleValueSource = styles.find(+ (styleDecl) => styleDecl.property === property+ )?.source.name;- if (- readonly === false &&- property &&- // reset when the value is set and after try to edit two sides- (styleValueSource === "local" || styleValueSource === "overwritten")- ) {- if (event.shiftKey && event.altKey) {- const properties = getSpaceModifiersGroup(property, {- shiftKey: true,- altKey: false,- });- const batch = createBatchUpdate();- for (const property of properties) {- batch.deleteProperty(property);+ if (+ readonly === false &&+ property &&+ // reset when the value is set and after try to edit two sides+ (styleValueSource === "local" ||+ styleValueSource === "overwritten")+ ) {+ if (event.shiftKey && event.altKey) {+ const properties = getSpaceModifiersGroup(property, {+ shiftKey: true,+ altKey: false,+ });+ const batch = createBatchUpdate();+ for (const property of properties) {+ batch.deleteProperty(property);+ }+ batch.publish();+ return;+ }+ if (event.altKey) {+ return;}- batch.publish();- return;}- if (event.altKey) {+ if (readonly) {return;}+ handleOpenProperty(property);+ }}+ onHover={readonly ? () => undefined : handleHover}+ onFocus={readonly ? undefined : keyboardNavigation.handleFocus}+ onBlur={readonly ? undefined : keyboardNavigation.handleBlur}+ activeProperties={activeProperties}+ onKeyDown={readonly ? undefined : keyboardNavigation.handleKeyDown}+ onMouseMove={+ readonly ? undefined : keyboardNavigation.handleMouseMove}- if (readonly) {- return;+ onMouseLeave={+ readonly ? undefined : keyboardNavigation.handleMouseLeave}- handleOpenProperty(property);- }}- onHover={readonly ? () => undefined : handleHover}- onFocus={readonly ? undefined : keyboardNavigation.handleFocus}- onBlur={readonly ? undefined : keyboardNavigation.handleBlur}- activeProperties={activeProperties}- onKeyDown={readonly ? undefined : keyboardNavigation.handleKeyDown}- onMouseMove={readonly ? undefined : keyboardNavigation.handleMouseMove}- onMouseLeave={- readonly ? undefined : keyboardNavigation.handleMouseLeave- }- renderCell={({ property }) => (- <Cell- isPopoverOpen={openProperty === property}- onPopoverClose={() => {- if (openProperty === property) {- handleOpenProperty(undefined);- layoutRef.current?.focus();- }- }}- onHover={handleHover}- property={property}- getActiveProperties={getActiveProperties}- scrubStatus={{- ...scrubStatus,- readonly,- }}- />- )}- />+ renderCell={({ property }) => (+ <Cell+ isPopoverOpen={openProperty === property}+ onPopoverClose={() => {+ if (openProperty === property) {+ handleOpenProperty(undefined);+ layoutRef.current?.focus();+ }+ }}+ onHover={handleHover}+ property={property}+ getActiveProperties={getActiveProperties}+ scrubStatus={{+ ...scrubStatus,+ readonly,+ }}+ />+ )}+ />+ </Flex></StyleSection>);};diff --git a/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx b/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsxindex 6d5a129d64..fd8bf621e6 100644--- a/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx@@ -72,7 +72,11 @@ export const properties = [export const Section = () => {return (<StyleSection label="Typography" properties={properties}>- <Flex gap="2" direction="column">+ <Flex+ gap="2"+ direction="column"+ css={{ paddingInline: theme.panel.paddingInline }}+ ><TypographySectionFont /><TypographySectionSizing /><TypographySectionAdvanced />diff --git a/apps/builder/app/builder/features/style-panel/shared/style-section.tsx b/apps/builder/app/builder/features/style-panel/shared/style-section.tsxindex f6b7621f68..2cebd79a86 100644--- a/apps/builder/app/builder/features/style-panel/shared/style-section.tsx+++ b/apps/builder/app/builder/features/style-panel/shared/style-section.tsx@@ -36,12 +36,10 @@ export const getDots = (styles: ComputedStyleDecl[]) => {export const StyleSection = (props: {label: string;properties: CssProperty[];- // @todo remove to keep sections consistent- fullWidth?: boolean;suffix?: ReactNode;children: ReactNode;}) => {- const { label, children, properties, fullWidth, suffix } = props;+ const { label, children, properties, suffix } = props;const [isOpen, setIsOpen] = useOpenState(label);const styles = useComputedStyles(properties);return (@@ -54,7 +52,7 @@ export const StyleSection = (props: {<SectionTitleLabel>{label}</SectionTitleLabel></SectionTitle>}- fullWidth={fullWidth}+ fullWidth>{children}</CollapsibleSectionRoot>diff --git a/apps/builder/app/builder/shared/collapsible-section.tsx b/apps/builder/app/builder/shared/collapsible-section.tsxindex 24eb191272..52aaf63187 100644--- a/apps/builder/app/builder/shared/collapsible-section.tsx+++ b/apps/builder/app/builder/shared/collapsible-section.tsx@@ -209,7 +209,7 @@ export const CollapsibleSectionWithAddButton = ({return (<CollapsibleSectionRootlabel={label}- fullWidth={false}+ fullWidth={props.fullWidth}showSeparator={props.showSeparator}isOpen={isOpenFinal}onOpenChange={(nextIsOpen) => {diff --git a/apps/builder/e2e/tests/mdx-content-block.[shard-4].e2e.ts b/apps/builder/e2e/tests/mdx-content-block.[shard-4].e2e.tsindex ef4ebd556c..2193605a7d 100644--- a/apps/builder/e2e/tests/mdx-content-block.[shard-4].e2e.ts+++ b/apps/builder/e2e/tests/mdx-content-block.[shard-4].e2e.ts@@ -833,6 +833,7 @@ test("Named MDX templates re-resolve after rename, reload, and removal", async (await chooseContentBlockSource({ page, filename: namedTemplateFilename });await confirmContentBlockConnection({ page });await waitForCanvasText({ page, text: "Authored lifecycle card" });+ await waitForSyncStatus({ page, status: "idle" });await expandNavigatorItem({ page, name: "Content Block" });await expandNavigatorItem({ page, name: "Block Template" });diff --git a/packages/design-system/src/components/section-title.tsx b/packages/design-system/src/components/section-title.tsxindex 22b66b6ff6..f0081ba383 100644--- a/packages/design-system/src/components/section-title.tsx+++ b/packages/design-system/src/components/section-title.tsx@@ -121,6 +121,7 @@ export const SectionTitle = forwardRef(css,children,suffix,+ suffixPlaceholder,inactive = false,collapsible = true,...props@@ -133,6 +134,8 @@ export const SectionTitle = forwardRef(css?: CSS;/** Primarily for <SectionTitleButton> */suffix?: ReactNode;+ /** Inert sizing copy when the suffix contains stateful components */+ suffixPlaceholder?: ReactNode;},ref: Ref<HTMLButtonElement>) => {@@ -181,7 +184,9 @@ export const SectionTitle = forwardRef({suffix && (/* In case of text overflow we need to place here the same suffix*/- <div className={invisibleSuffixStyle()}>{suffix}</div>+ <div className={invisibleSuffixStyle()}>+ {suffixPlaceholder ?? suffix}+ </div>)}</div></div>