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

IBX-3826: [Navigation menu] Field groups navigation menu cannot select 2nd choice #569

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}

const SECTION_ADJUST_MARGIN_TOP = 20;
const CONTENT_PADDING_TOP = 42;
const formContainerNode = doc.querySelector('.ibexa-edit-content');
const getSecondarySectionActiveItems = () => {
const secondarySectionItems = formContainerNode.querySelectorAll(
Expand All @@ -15,11 +16,19 @@
return [...secondarySectionItems];
};
let currentlyVisibleSections = getSecondarySectionActiveItems();
const getFirstSection = (sectionGroup) => {
return sectionGroup.querySelector('.ibexa-edit-content__secondary-section');
};
const getLastSection = (sectionGroup) => {
const sections = [...sectionGroup.querySelectorAll('.ibexa-edit-content__secondary-section')];

return sections[sections.length - 1];
};
const fitSecondarySections = () => {
const primarySection = doc.querySelector('.ibexa-edit-content__primary-section--active');
const contentColumn = doc.querySelector('.ibexa-main-container__content-column');
const firstSection = primarySection.firstElementChild;
const lastSection = primarySection.lastElementChild;
const firstSection = getFirstSection(primarySection);
const lastSection = getLastSection(primarySection);
const contentContainer = contentColumn.querySelector('.ibexa-edit-content__container');

contentContainer.style.paddingBottom = '0px';
Expand All @@ -39,7 +48,7 @@
const secondarySectionNode = formContainerNode.querySelector(`.ibexa-edit-content__secondary-section[data-id="${targetId}"]`);

formContainerNode.scrollTo({
top: secondarySectionNode.offsetTop,
top: secondarySectionNode.offsetTop + CONTENT_PADDING_TOP,
behavior: 'smooth',
});
};
Expand Down