File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
apps/builder/app/builder/features/style-panel/shared/css-value-input Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -345,6 +345,9 @@ export const CssValueInput = ({
345345 ...props
346346} : CssValueInputProps ) => {
347347 const value = props . intermediateValue ?? props . value ?? initialValue ;
348+ const valueRef = useRef ( value ) ;
349+ valueRef . current = value ;
350+
348351 // Used to show description
349352 const [ highlightedValue , setHighlighedValue ] = useState <
350353 StyleValue | undefined
@@ -524,7 +527,15 @@ export const CssValueInput = ({
524527 } ) ;
525528
526529 const shouldHandleEvent = useCallback ( ( node : Node ) => {
527- return suffixRef . current ?. contains ?.( node ) === false ;
530+ // prevent scrubbing when css variable is selected
531+ if ( valueRef . current . type === "var" ) {
532+ return false ;
533+ }
534+ // prevent scrubbing when unit select is in use
535+ if ( suffixRef . current ?. contains ?.( node ) ) {
536+ return false ;
537+ }
538+ return true ;
528539 } , [ ] ) ;
529540
530541 const [ scrubRef , inputRef ] = useScrub ( {
You can’t perform that action at this time.
0 commit comments