diff --git a/src/bundle/Resources/public/js/scripts/core/multilevel.popup.menu.js b/src/bundle/Resources/public/js/scripts/core/multilevel.popup.menu.js
index 44ee62f767..12ba1e7537 100644
--- a/src/bundle/Resources/public/js/scripts/core/multilevel.popup.menu.js
+++ b/src/bundle/Resources/public/js/scripts/core/multilevel.popup.menu.js
@@ -137,6 +137,14 @@
},
false,
);
+ branchElement.addEventListener(
+ 'ibexa-multilevel-popup-menu:close-branch',
+ () => {
+ this.hoveredBranches.delete(branchElement);
+ this.updateBranchAndParentBranchesOpenState(branchElement);
+ },
+ false,
+ );
processBranchAfter(branchElement);
branchItems.forEach((itemElement) => processBranchItemAfter(itemElement));
@@ -394,14 +402,14 @@
return;
}
- const branchsSearchInput = doc.querySelectorAll('.ibexa-multilevel-popup-menu__search-input');
+ const branchesSearchInput = doc.querySelectorAll('.ibexa-multilevel-popup-menu__search-input');
- branchsSearchInput.forEach((searchInput) => {
+ branchesSearchInput.forEach((searchInput) => {
if (searchInput.value !== '') {
const searchInputBranch = searchInput.closest('.ibexa-multilevel-popup-menu__branch');
searchInput.value = '';
- searchInputBranch.dispatchEvent(new Event('mouseleave'));
+ searchInputBranch.dispatchEvent(new CustomEvent('ibexa-multilevel-popup-menu:close-branch'));
searchInput.dispatchEvent(new Event('input'));
}
});
@@ -416,9 +424,9 @@
const phraseLowerCase = searchInput.value.toLowerCase();
branchItems.forEach((item) => {
- const { label } = item.dataset;
- const labelLowerCase = label.toLowerCase();
- const hideItem = !labelLowerCase.includes(phraseLowerCase);
+ const { searchLabel } = item.dataset;
+ const searchLabelLowerCase = searchLabel.toLowerCase();
+ const hideItem = !searchLabelLowerCase.includes(phraseLowerCase);
item.classList.toggle('ibexa-popup-menu__item--hidden', hideItem);
});
diff --git a/src/bundle/Resources/public/js/scripts/embedded.item.actions.js b/src/bundle/Resources/public/js/scripts/embedded.item.actions.js
index 8fbb9a1195..655962c696 100644
--- a/src/bundle/Resources/public/js/scripts/embedded.item.actions.js
+++ b/src/bundle/Resources/public/js/scripts/embedded.item.actions.js
@@ -2,7 +2,7 @@
const MIN_ITEMS_NUMBER_TO_SHOW_SEARCH = 10;
const MENU_PROPS = {
placement: 'bottom-start',
- fallbackPlacements: ['bottom-start', 'top-end', 'top-start'],
+ fallbackPlacements: ['top-end', 'top-start'],
};
const token = document.querySelector('meta[name="CSRF-Token"]').content;
const siteaccess = document.querySelector('meta[name="SiteAccess"]').content;
@@ -201,14 +201,12 @@
}
};
const getMenuData = ({ container, event }) => {
- const { contentId, locationId, productCode, languageCodes } = container ? container.dataset : event.detail;
+ const { contentId, locationId, productCode, languageCodes = [] } = container ? container.dataset : event.detail;
const parsedLanguageCodes = typeof languageCodes === 'string' ? JSON.parse(languageCodes) : languageCodes;
- const languages = parsedLanguageCodes
- ? parsedLanguageCodes.map((languageCode) => ({
- languageCode,
- name: adminUiLanguages[languageCode].name,
- }))
- : [];
+ const languages = parsedLanguageCodes.map((languageCode) => ({
+ languageCode,
+ name: adminUiLanguages[languageCode].name,
+ }));
return {
contentId: parseInt(contentId, 10),
diff --git a/src/bundle/Resources/translations/ibexa_multilevel_popup_menu.en.xliff b/src/bundle/Resources/translations/ibexa_multilevel_popup_menu.en.xliff
new file mode 100644
index 0000000000..f428cffcf6
--- /dev/null
+++ b/src/bundle/Resources/translations/ibexa_multilevel_popup_menu.en.xliff
@@ -0,0 +1,16 @@
+
+