Skip to content

Commit f3b0567

Browse files
committed
fix(ui5-input): Suggestions can now be arbitrary list items (#1969)
1 parent a75c96d commit f3b0567

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/main/src/Input.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,18 +802,19 @@ class Input extends UI5Element {
802802
}
803803

804804
previewSuggestion(item) {
805-
const emptyValue = item.type === "Inactive" || item.group;
806805
this.valueBeforeItemSelection = this.value;
807-
this.updateValueOnPreview(emptyValue ? "" : item.effectiveTitle);
806+
this.updateValueOnPreview(item);
808807
this.announceSelectedItem();
809808
this._previewItem = item;
810809
}
811810

812811
/**
813812
* Updates the input value on item preview.
814-
* @param {itemValue} itemValue The value of the item that is on preview
813+
* @param {Object} item The item that is on preview
815814
*/
816-
updateValueOnPreview(itemValue) {
815+
updateValueOnPreview(item) {
816+
const noPreview = item.type === "Inactive" || item.group;
817+
const itemValue = noPreview ? "" : (item.effectiveTitle || item.textContent);
817818
this.value = itemValue;
818819
}
819820

packages/main/src/features/InputSuggestions.js

Lines changed: 1 addition & 1 deletion
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)