material-components-web-react icon indicating copy to clipboard operation
material-components-web-react copied to clipboard

All components with events should follow the controlled component pattern

Open moog16 opened this issue 5 years ago • 6 comments

Similar to text-field, all components with events should follow the controlled component pattern. This gives the developer more control over the state of the component. This should also simplify some of the component's logic surrounding events.

  • [ ] checkbox
  • [ ] dialog
  • [ ] chips
  • [ ] IconButton
  • [ ] drawer

related #772

moog16 avatar Mar 28 '19 22:03 moog16

drawer too, right?

lucasecdb avatar Mar 30 '19 01:03 lucasecdb

@lucascdb drawer too yes!

moog16 avatar Mar 30 '19 03:03 moog16

@lucasecdb drawer actually follows the controlled component pattern.

moog16 avatar May 03 '19 18:05 moog16

it has the API for a controlled component, but it doesn't "respect" it. like, if I don't do anything on the onClose callback, the drawer will close anyway, even though the open prop is still set to true.

lucasecdb avatar May 03 '19 18:05 lucasecdb

You are right...I checked dismissible, but only removed the open prop. Adding it back. Thanks

moog16 avatar May 03 '19 18:05 moog16

Are there plans to support the controlled components pattern for Menu (or MenuSurface) as well?

Jaredk3nt avatar Sep 11 '19 21:09 Jaredk3nt