Skip to content

Commit

Permalink
nesting level changed and commented code removed
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatkhurana-adobe committed Sep 12, 2024
1 parent 64a2860 commit a191117
Showing 1 changed file with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
static IS = "adaptiveFormContainer";
static bemBlock = 'cmp-adaptiveform-container';
static hamburgerSupport = false;
static nestingSupport = 5;
static nestingSupport = 3;

static selectors = {
self: "[data-" + this.NS + '-is="' + this.IS + '"]',
Expand Down Expand Up @@ -232,16 +232,6 @@
return state.items || [];
}

function findDeeplyNestedFirstLi(rootListItem) {
// Base case: if the current item has no children, return it
const firstChildLi = rootListItem.querySelector('li');
if (!firstChildLi) {
return rootListItem;
}
// Recursive case: continue searching in the first child
return findDeeplyNestedFirstLi(firstChildLi);
}

function updateSelectedPanelTitle(anchorElement) {
const navTitleText = anchorElement?.innerText;
const navTitle = document.querySelector(FormContainerV2.selectors.navTitle);
Expand Down Expand Up @@ -464,18 +454,12 @@

if (direction === 'prev' && newActiveItemIndex < 0) {
newActiveItemIndex = menuListItems.length - 1;
}
// else if (direction === 'next' && newActiveItemIndex >= menuListItems.length) {
// newActiveItemIndex = 0;
// }

// Find the next visible item
}
while (!isEligible(menuListItems[newActiveItemIndex], direction)) {
newActiveItemIndex = direction === 'prev'
? (newActiveItemIndex - 1 + menuListItems.length) % menuListItems.length
: (newActiveItemIndex + 1) % menuListItems.length;
}

const newActiveItem = menuListItems[newActiveItemIndex];
activeItemId = newActiveItem?.getAttribute('data-cmp-id');
newActiveItem?.click();
Expand Down Expand Up @@ -559,7 +543,6 @@
addEventsToNavigationButtons();
const rootListItems = menu.querySelectorAll(FormContainerV2.selectors.hamburgerMenu + ' > li');

// let deeplyNestedFirstLi = findDeeplyNestedFirstLi(rootListItems[0]);
if (rootListItems[0] && rootListItems[0].tagName === 'LI') {
rootListItems[0].click();
menu.style.display = 'none';
Expand Down Expand Up @@ -664,5 +647,4 @@
} else {
document.addEventListener("DOMContentLoaded", onDocumentReady);
}

})();

0 comments on commit a191117

Please sign in to comment.