Skip to content

Commit

Permalink
fix(ui5-input): Suggestions can now be arbitrary list items (#1969)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladitasev committed Jul 28, 2020
1 parent a75c96d commit f3b0567
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,18 +802,19 @@ class Input extends UI5Element {
}

previewSuggestion(item) {
const emptyValue = item.type === "Inactive" || item.group;
this.valueBeforeItemSelection = this.value;
this.updateValueOnPreview(emptyValue ? "" : item.effectiveTitle);
this.updateValueOnPreview(item);
this.announceSelectedItem();
this._previewItem = item;
}

/**
* Updates the input value on item preview.
* @param {itemValue} itemValue The value of the item that is on preview
* @param {Object} item The item that is on preview
*/
updateValueOnPreview(itemValue) {
updateValueOnPreview(item) {
const noPreview = item.type === "Inactive" || item.group;
const itemValue = noPreview ? "" : (item.effectiveTitle || item.textContent);
this.value = itemValue;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/features/InputSuggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class Suggestions {
}

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

_getComponent() {
Expand Down

0 comments on commit f3b0567

Please sign in to comment.