diff --git a/packages/react/lib/Dropdown/index.js b/packages/react/lib/Dropdown/index.js index f661285e1..852037d27 100644 --- a/packages/react/lib/Dropdown/index.js +++ b/packages/react/lib/Dropdown/index.js @@ -43,10 +43,7 @@ const Dropdown = forwardRef(({ }); const { x, y, reference, floating, strategy, context } = useFloating({ open: state.opened, - onOpenChange: o => { - dispatch({ opened: o }); - onToggle?.({ opened: o }); - }, + onOpenChange: (...args) => onOpenChange(...args), placement, strategy: 'fixed', whileElementsMounted: autoUpdate, @@ -88,6 +85,15 @@ const Dropdown = forwardRef(({ innerRef, })); + const onOpenChange = o => { + if (disabled && o) { + return; + } + + dispatch({ opened: o }); + onToggle?.({ opened: o }); + }; + const toggle = () => { if (disabled) { return;