UX: avoid footer admin menu from overflowing top (#24149)

This commit is contained in:
Kris 2023-10-30 10:55:17 -04:00 committed by GitHub
parent 68728806c1
commit 2e06cc1248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import $ from "jquery";
import { h } from "virtual-dom";
import { headerOffset } from "discourse/lib/offset-calculator";
import { applyDecorators, createWidget } from "discourse/widgets/widget";
createWidget("admin-menu-button", {
@ -328,6 +329,7 @@ export default createWidget("topic-admin-menu", {
buildAttributes(attrs) {
let { top, left, outerHeight } = attrs.position;
const position = this.site.mobileView ? "fixed" : "absolute";
const approxMenuHeight = attrs.actionButtons.length * 42;
if (attrs.rightSide) {
return;
@ -343,6 +345,11 @@ export default createWidget("topic-admin-menu", {
bottom = bottom - (documentHeight - mainHeight) - outerHeight;
}
if (top < approxMenuHeight) {
bottom =
bottom - (approxMenuHeight - outerHeight - top) - headerOffset();
}
if (this.site.mobileView) {
bottom = 50;
left = 0;