Skip to content

Commit

Permalink
fix(menu): correct handling of empty dynamic menus #115
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-capsule42 committed Feb 2, 2023
1 parent 2e76d80 commit 070d7e9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/auro-combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ class AuroCombobox extends LitElement {
* @returns {void}
*/
showBib() {
if (!this.dropdown.isPopoverVisible && this.availableOptions && this.availableOptions.length > 0 && this.input.value && this.input.value.length > 0) {
this.dropdown.show();
if (!this.dropdown.isPopoverVisible && this.input.value && this.input.value.length > 0) {
if (this.noFilter || (this.availableOptions && this.availableOptions.length > 0)) { // eslint-disable-line no-extra-parens
this.dropdown.show();
}
}
}

Expand Down Expand Up @@ -246,9 +248,14 @@ class AuroCombobox extends LitElement {
* @returns {void}
*/
configureMenu() {
this.menu.addEventListener('auroMenu-ready', () => {
if (this.noFilter) {
this.auroMenuReady = true;
});
} else {
this.menu.addEventListener('auroMenu-ready', () => {
this.auroMenuReady = true;
});
}


// handle the menu event for an option selection
this.addEventListener('auroMenu-selectedOption', () => {
Expand Down Expand Up @@ -607,6 +614,10 @@ class AuroCombobox extends LitElement {
* @returns {void}
*/
handleSlotChange() {
if (this.auroMenuReady) {
this.options = this.menu.querySelectorAll('auro-menuoption');
}

this.handleMenuOptions();
}

Expand Down

0 comments on commit 070d7e9

Please sign in to comment.