react-magma icon indicating copy to clipboard operation
react-magma copied to clipboard

Dropdown open/closed status cannot persist between renders

Open jerrodheiser opened this issue 3 years ago • 1 comments

Describe the bug Re-renders of a Dropdown instance render with the Dropdown in a "closed" state. Current functionality does not provide for persistence of the Dropdown's open/closed status between render cycles.

Additional context

  1. The desired behavior is that the parent component is given a means to control the Dropdowns open/closed status.
  2. The following is an example where this behavior is not accessible:
  • Dropdown content consists of a form element.
  • Form element contains Checkbox elements, acting as toggleable filters.
  • Checkbox values are defined pre-render. Therefore, Checkbox values are kept in parent component state.
  • Checkbox onChange functions manipulate parent component state, which causes the Dropdown to re-render in a closed state.
  1. Drawer/Modal are examples of components which take an isOpen prop, whcih would provide the desired functionality.

jerrodheiser avatar Oct 24 '22 20:10 jerrodheiser

Note: only fix in v3. Release before December 2022

silvalaura avatar Oct 24 '22 20:10 silvalaura

Not reproducible. This is addressed by using Dropdown form.

silvalaura avatar Nov 22 '22 15:11 silvalaura