From 2e06cc12486e667eae3441d8c917f50b0a061b6f Mon Sep 17 00:00:00 2001 From: Kris Date: Mon, 30 Oct 2023 10:55:17 -0400 Subject: [PATCH] UX: avoid footer admin menu from overflowing top (#24149) --- .../javascripts/discourse/app/widgets/topic-admin-menu.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js b/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js index e038d8ea192..8b5ab27f5ec 100644 --- a/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js @@ -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;