wired-combo not updating selected attribute or firing onchange event
MarcSkovMadsen opened this issue · 2 comments
My Pain
I'm trying to make a general plugin for web component for Panel. Panel is a framework for creating awesome analytics apps in Python.
I would like to include support for the wired elements. Would be awesome.
The general plugin monitors the web components attributes and uses the onchange
attribute. Neither of which is changed/ executed when the combo selection changes. Instead I can see that the selection
event is fired.
I don't know if it is true but I would expect best practice for web components is to update the selected attribute and/ or execute the onchange
attribute.
Solution
- update selection attribute when selection changes
- fire onchange attribute when selection changes.
Thanks.
I've been able to find a work around for my use case. But I still believe it's important in general to solve.
Hello,
Events
Those are the suggested best practices for events:
https://developers.google.com/web/fundamentals/web-components/best-practices#events
- Dispatch events in response to internal component activity.
- Do not dispatch events in response to the host setting a property (downward data flow).
There is however no convention on the event name.
Reflect attributes
Those are the suggested best practices for reflecting attributes:
https://developers.google.com/web/fundamentals/web-components/best-practices#aim-to-keep-primitive-data-attributes-and-properties-in-sync,-reflecting-from-property-to-attribute,-and-vice-versa.
=> here I agree that the "selected" attribute should be reflected as it is a string. Currently, only the "disabled" attribute is reflected.
I can make a PR on this.
Regards,