vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
429 stars 82 forks source link

[list-mixin] Add change event to ensure selected is changed by user #1575

Open web-padawan opened 5 years ago

web-padawan commented 5 years ago

Currently, the selected is changed on click and produces selected-changed event:

https://github.com/vaadin/vaadin-list-mixin/blob/e489859b5d904c49ccb17a88d7f3184b5b9019ac/vaadin-list-mixin.html#L117

This is then used by vaadin-select to update its value: https://github.com/vaadin/vaadin-select/blob/9f1bc3067a5e1428318b4055307fb7ae5e84b05d/src/vaadin-select.html#L431

However, there it causes unexpected results: the dropdown is closed even though the value is set on the initialization, e.g. when you assign a renderer. This makes the vaadin-select buggy and requires workarounds, especially when used inside of vaadin-grid-pro inline cell editor.

robrez commented 4 years ago

I've been having to work around this, too, a bit;

Is the fix as simple as dispatching a change event from onClick in list-mixin and likewise from onMultipleClick in multi-select-list-mixin?

Do you accept PRs, or is this something the vaadin team would like to handle internally?