Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core/ix-menu-category): dynamic added items not visible #1706

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
remove useless logic
  • Loading branch information
lzeiml committed Feb 25, 2025
commit a0a88bb2bc1244887bbe48ca88698da28a0b35bb
22 changes: 8 additions & 14 deletions packages/core/src/components/menu-category/menu-category.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ export class MenuCategory {
this.showItems = true;
this.showDropdown = false;
},
complete: () => {
this.menuItemsContainer!.removeAttribute('max-height');
this.setMenuItemsContainerMaxHeight();
},
});
}

Expand Down Expand Up @@ -158,8 +154,14 @@ export class MenuCategory {
const oldNestedItemsLength: number = this.nestedItems.length;
this.nestedItems = this.getNestedItems();

if (this.showItems && oldNestedItemsLength !== this.nestedItems.length) {
this.setMenuItemsContainerMaxHeight();
if (
this.showItems &&
this.menuItemsContainer &&
oldNestedItemsLength !== this.nestedItems.length
) {
this.menuItemsContainer.style.maxHeight = `${
this.getNestedItemsHeight() + DefaultIxMenuItemHeight
}px`;
}

if (!this.menuExpand || this.showItems || !mutations) {
Expand All @@ -179,14 +181,6 @@ export class MenuCategory {
}
}

private setMenuItemsContainerMaxHeight() {
if (this.menuItemsContainer) {
this.menuItemsContainer.style.maxHeight = `${
this.getNestedItemsHeight() + DefaultIxMenuItemHeight
}px`;
}
}

private isCategoryItemListVisible() {
return this.menuExpand && (this.showItems || this.isNestedItemActive());
}
Expand Down
Loading