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;