fix: support numeric values for CSS logical properties in useTransform #3430
+144
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Summary
useTransformdid not correctly convert numeric values to pixel units when used with CSS logical properties (e.g.paddingBlock,paddingInline,marginBlock,marginInline), causing styles to update incorrectly.This PR fixes the missing px conversion so CSS logical properties are handled consistently with other CSS properties.
Root Cause
CSS logical properties were missing from the internal px conversion mappings (
numberValueTypesandpxValues).As a result, numeric values returned from
useTransformwere written to the DOM without units and treated as invalid CSS.Because CSS allows unitless
0, intermediate values were ignored, making updates appear to jump from0to the final value.Solution
CSS logical properties were added to both px conversion paths.
Updated files
packages/motion-dom/src/value/types/maps/number.tspackages/motion-dom/src/animation/waapi/utils/px-values.tsNumeric values returned from
useTransformare now converted to"px"before being applied to the DOM.As-is / To-be
As-is
px2025-12-27.11.27.31.mov
To-be
2025-12-27.11.31.44.mov