Skip to content

Commit aa6fde4

Browse files
authored
fix(ui5-input): Suggestions can now be arbitrary list items (#1969)
1 parent 8b66a95 commit aa6fde4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/main/src/Input.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -799,18 +799,19 @@ class Input extends UI5Element {
799799
}
800800

801801
previewSuggestion(item) {
802-
const emptyValue = item.type === "Inactive" || item.group;
803802
this.valueBeforeItemSelection = this.value;
804-
this.updateValueOnPreview(emptyValue ? "" : item.effectiveTitle);
803+
this.updateValueOnPreview(item);
805804
this.announceSelectedItem();
806805
this._previewItem = item;
807806
}
808807

809808
/**
810809
* Updates the input value on item preview.
811-
* @param {itemValue} itemValue The value of the item that is on preview
810+
* @param {Object} item The item that is on preview
812811
*/
813-
updateValueOnPreview(itemValue) {
812+
updateValueOnPreview(item) {
813+
const noPreview = item.type === "Inactive" || item.group;
814+
const itemValue = noPreview ? "" : (item.effectiveTitle || item.textContent);
814815
this.value = itemValue;
815816
}
816817

packages/main/src/features/InputSuggestions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class Suggestions {
318318
}
319319

320320
_getItems() {
321-
return [].slice.call(this.responsivePopover.querySelectorAll("ui5-li-groupheader, ui5-li-suggestion-item"));
321+
return [...this.responsivePopover.querySelectorAll("ui5-list>*")];
322322
}
323323

324324
_getComponent() {

0 commit comments

Comments
 (0)