Description
The PR #2750 added autoselect property mixin to the ComboBox, but as ComboBox is relying on inherited functionality that does not handle ComboBox special cases, notably ComboBox opens drop down when clicking the component, which interferes the autoselect functionality.
The autoselect in combo-box is applied as expected on focus. However, when closing the combo-box on outside click, it doesn't lose focus but loses selection. Then subsequent clicks do not select the text.
Expected outcome
The autoselect attribute should work flawlesly.
Minimal reproducible example
Trivial
Java:
comboBox.getElement("autoselect","true")
or
<vaadin-combo-box autoselect="true" ...></vaadin-combo-box>
Steps to reproduce
I do not know what it does, but I think it does not work. If I use comboBox.getElement("autoselect","true"), it does not select the text when clicking the ComboBox. I think the problem is that ComboBox internal click listener hijacks the event.
However when I add event listener to input element to select its content on click, it seems to work in some cases:
comboBox.getElement().executeJs("$0.addEventListener('click', (e) => $0.inputElement.select());", comboBox.getElement());
Environment
Vaadin version(s): 25.0.4, 24.9.11
Browsers
No response
Description
The PR #2750 added autoselect property mixin to the ComboBox, but as ComboBox is relying on inherited functionality that does not handle ComboBox special cases, notably ComboBox opens drop down when clicking the component, which interferes the autoselect functionality.
The autoselect in combo-box is applied as expected on focus. However, when closing the combo-box on outside click, it doesn't lose focus but loses selection. Then subsequent clicks do not select the text.
Expected outcome
The autoselect attribute should work flawlesly.
Minimal reproducible example
Trivial
Java:
comboBox.getElement("autoselect","true")or
<vaadin-combo-box autoselect="true" ...></vaadin-combo-box>Steps to reproduce
I do not know what it does, but I think it does not work. If I use comboBox.getElement("autoselect","true"), it does not select the text when clicking the ComboBox. I think the problem is that ComboBox internal click listener hijacks the event.
However when I add event listener to input element to select its content on click, it seems to work in some cases:
comboBox.getElement().executeJs("$0.addEventListener('click', (e) => $0.inputElement.select());", comboBox.getElement());Environment
Vaadin version(s): 25.0.4, 24.9.11
Browsers
No response