Links with children have the `active` class set on them, but links without have it placed on the parent instead.
See https://www.woltlab.com/community/thread/296045-mobiles-hauptmen%C3%BC-teilweise-nicht-vorausgew%C3%A4hlt-wenn-man-auf-einer-unterseite-is/
return Array.from(category.querySelectorAll(".acpPageSubMenuLink")).map((link: HTMLAnchorElement) => {
const children = getMenuItemActions(link);
+ let active = link.classList.contains("active");
+ if (children.length === 0 && link.parentElement!.classList.contains("active")) {
+ active = true;
+ }
+
return {
- active: link.classList.contains("active"),
+ active,
children,
counter: 0,
depth: 2,
function getMenuItems(category) {
return Array.from(category.querySelectorAll(".acpPageSubMenuLink")).map((link) => {
const children = getMenuItemActions(link);
+ let active = link.classList.contains("active");
+ if (children.length === 0 && link.parentElement.classList.contains("active")) {
+ active = true;
+ }
return {
- active: link.classList.contains("active"),
+ active,
children,
counter: 0,
depth: 2,