preact-material-components
preact-material-components copied to clipboard
Standard API for major event handlers in 2.0
While we're writing components for 2.0, we should standardize the API got event handlers.
Currently with props all event handlers are native event handlers.
E.g: onChange of a checkbox is the native onChange of input type=checkbox
This leads to some problems, mdc-web introduce some additional properties on top of native controls.
E.g. checkbox has a indeterminate state, select has selectedIndex etc.
Getting these values from native event handlers which just pass the Event, is tricky and most times requires creating a ref.
In order to solve this we can send added details to major event handlers(not necessarily all) like onChange for checkbox, select, onClick for button etc.
Current TS definition:
onClick: (e:Event) => void;
Updated version:
onChange:(e:Event, object: {
MDComponent: MaterialComponent;
checked: boolean;
indeterminate: boolean;
}) => void
The additional object makes sure that it is not counter intuitive to users if 1.0
There currently carnival were I am, so I'm not available today
But that's a good idea
No worries... It isn't something to be fixed immediately. That's just something we confirm to as we update all the components.. Enjoy the carnival ☺️
I guess this is done is'nt it?
Tabs are remaining. 1 last one i guess
Possible