paragon
paragon copied to clipboard
`Dropdown` component's `onToggle` prop is only called on close, not on open.
The Dropdown component accepts an onToggle prop, however it is only called when the component is closed, not opened. Its intent, though, is to be called on open or on close, since the isOpen state variable is passed as a function argument to onToggle callback function.
In the handleToggle function, we do an early return preventing the onToggle callback function from being called: https://github.com/openedx/paragon/blob/5013f9a0304a04995a83da3535a8b7bc2fa67ae6/src/Dropdown/index.jsx#L44
AC
- Verify
onToggleis called both on open and on close, with the appropriate function arguments (e.g.,isOpenshould be false is the dropdown was just closed). - Ensure
onToggleis part of the props API on the documentation website.