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: Fix scrub - disable it when its on non-numeric values (#5517)
Oleg Isonen7dd28907275b
diff --git a/apps/builder/app/builder/features/style-panel/sections/position/inset-control.tsx b/apps/builder/app/builder/features/style-panel/sections/position/inset-control.tsxindex cf4c7531ce..7b84538256 100644--- a/apps/builder/app/builder/features/style-panel/sections/position/inset-control.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/position/inset-control.tsx@@ -70,12 +70,13 @@ type HoverTarget = {export const InsetControl = () => {const styles = useComputedStyles(["top", "right", "bottom", "left"]);const [hoverTarget, setHoverTarget] = useState<HoverTarget>();+ const styleValue = styles.find(+ (styleDecl) => styleDecl.property === hoverTarget?.property+ );const scrubStatus = useScrub({- value: styles.find(- (styleDecl) => styleDecl.property === hoverTarget?.property- )?.usedValue,- target: hoverTarget,+ value: styleValue?.usedValue,+ target: styleValue?.cascadedValue.type === "unit" ? hoverTarget : undefined,getModifiersGroup: getInsetModifiersGroup,onChange: (values, options) => {const batch = createBatchUpdate();diff --git a/apps/builder/app/builder/features/style-panel/sections/shared/scrub.tsx b/apps/builder/app/builder/features/style-panel/sections/shared/scrub.tsxindex c50c90d269..50404ddade 100644--- a/apps/builder/app/builder/features/style-panel/sections/shared/scrub.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/shared/scrub.tsx@@ -81,14 +81,6 @@ export const useScrub = <P extends CssProperty>(props: {return;}- // Don't activate scrub for non-numeric intermediate values- const numericValue = Number.parseFloat(- finalTarget.element.textContent ?? ""- );- if (Number.isNaN(numericValue)) {- return;- }-const property = finalTarget.property;const handleChange = (event: { value: number }, isEphemeral: boolean) => {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 7be58e0850..366dd4bd40 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@@ -140,12 +140,12 @@ export { spaceProperties as properties };export const Section = () => {const styles = useComputedStyles(spaceProperties);const [hoverTarget, setHoverTarget] = useState<HoverTarget>();-+ const styleValue = styles.find(+ (styleDecl) => styleDecl.property === hoverTarget?.property+ );const scrubStatus = useScrub({- value: styles.find(- (styleDecl) => styleDecl.property === hoverTarget?.property- )?.usedValue,- target: hoverTarget,+ value: styleValue?.usedValue,+ target: styleValue?.cascadedValue.type === "unit" ? hoverTarget : undefined,getModifiersGroup: getSpaceModifiersGroup,onChange: (values, options) => {const batch = createBatchUpdate();