UX: allow profile menu tabs to scroll if needed (#20619)

This commit is contained in:
Kris
2023-03-21 13:49:19 -04:00
committed by GitHub
parent 7b01576c8d
commit 1ed70d17ed
2 changed files with 26 additions and 7 deletions
@@ -664,14 +664,32 @@ export default createWidget("header", {
},
preventDefault(e) {
// prevent all scrolling on menu panels, except on overflow
const height = window.innerHeight ? window.innerHeight : $(window).height();
if (
!$(e.target).parents(".menu-panel").length ||
$(".menu-panel .panel-body-contents").height() <= height
) {
e.preventDefault();
const windowHeight = window.innerHeight;
// allow profile menu tabs to scroll if they're taller than the window
if (e.target.closest(".menu-panel .menu-tabs-container")) {
const topTabs = document.querySelector(".menu-panel .top-tabs");
const bottomTabs = document.querySelector(".menu-panel .bottom-tabs");
const profileTabsHeight =
topTabs?.offsetHeight + bottomTabs?.offsetHeight || 0;
if (profileTabsHeight > windowHeight) {
return;
}
}
// allow menu panels to scroll if contents are taller than the window
if (e.target.closest(".menu-panel")) {
const menuContentHeight =
document.querySelector(".menu-panel .panel-body-contents")
.offsetHeight || 0;
if (menuContentHeight > windowHeight) {
return;
}
}
e.preventDefault();
},
togglePageSearch() {
@@ -111,6 +111,7 @@
border-left: 1px solid var(--primary-low);
padding: 0.75em 0 0;
overflow-y: auto;
overscroll-behavior: contain;
}
.tabs-list {