-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardize widget events #302
Comments
My approach would be as follows: Event handler arguments
We've already run into cases where we need to know which of an array of VNodes triggered an event. Right now we've gotten around it by implementing an Which Events?
In context of the current widgets, this would mean ComboBox, TimePicker, Select, and SplitPane should support the full set of |
From the comment on #266: Update widget events to not return the event object. Instead, we should return whatever value is appropriate to the function (e.g. _input1 = '';
_input2 = '';
_input3 = '';
private _onInput(value: string, key: string | number) {
this[`_${key}`] = value;
this.invalidate();
}
render() {
return v('div', [
w(TextInput, {
key: 'input1',
onInput: this._onInput
}),
w(TextInput, {
key: 'input2',
onInput: this._onInput
}),
w(TextInput, {
key: 'input3',
onInput: this._onInput
})
]);
} |
The other option is to use a separate common identifier like |
By not returning the object, are we thinking that we'd relay meaningful values from the underlying node (like |
Yup, for events like This does remove the ability to call |
I think passing that through on events where it matters is a good idea |
Would we create an Event object and selectively add information to it, which would allow functionality like |
What do you mean by raw values? I think we'd like to create an event object and selectively add info to it. |
I agree that we should change and standardise the params that we pass to callbacks from our vdom events. This will in part be achieved by the changes to In terms of |
Enhancement
The approach to widget events is fragmented across existing widgets. Basic form widgets have handlers for all interaction events (mouse, touch, and keyboard), and pass back the dom event object as the argument. Most other widgets only include widget-specific events (e.g.
onOpen
for Dialog), and pass some part of requested state back as the argument (e.g.year
foronYearChange
in Calendar).Widgets could be improved by standardizing event handlers in two ways:
The text was updated successfully, but these errors were encountered: