Skip to content

Commit

Permalink
Merge branch '6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdesign committed Sep 13, 2024
2 parents 1fdd644 + 789bbe5 commit e6d8276
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ function onScroll() {
});
}

/**
* Recalculates drop-down positions on page resize.
*/
function onWindowResize() {
_dropdowns.forEach((dropdown, containerId) => {
if (!dropdown.classList.contains("dropdownOpen")) {
return;
}

UiDropdownSimple.setAlignment(dropdown, _menus.get(containerId)!);
});
}

/**
* Notifies callbacks on status change.
*/
Expand Down Expand Up @@ -367,6 +380,7 @@ const UiDropdownSimple = {
wheneverFirstSeen(".dropdownToggle", (button) => UiDropdownSimple.init(button, false));

document.addEventListener("scroll", onScroll);
window.addEventListener("resize", () => onWindowResize(), { passive: true });

// expose on window object for backward compatibility
window.bc_wcfSimpleDropdown = this;
Expand Down
14 changes: 14 additions & 0 deletions ts/WoltLabSuite/Core/Ui/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ function initSearchBar(): void {

_pageHeaderSearchMobile?.setAttribute("aria-expanded", "false");
});

window.addEventListener(
"resize",
() => {
if (_isMobile || !_pageHeader.classList.contains("searchBarOpen")) {
return;
}

UiAlignment.set(_pageHeaderSearch, _topMenu, {
horizontal: "right",
});
},
{ passive: true },
);
}

function initMobileSearch(): void {
Expand Down
12 changes: 12 additions & 0 deletions wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e6d8276

Please sign in to comment.