mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 10:47:46 -05:00
UX: allow profile menu tabs to scroll if needed (#20619)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user