So, the code in question is:
_dock() {
const $wrapper = this.$();
if (!$wrapper || $wrapper.length === 0) return;
const offset = window.pageYOffset || $("html").scrollTop();
const progressHeight = this.site.mobileView
? 0
: $("#topic-progress").height();
const maximumOffset = $("#topic-bottom").offset().top + progressHeight;
const windowHeight = $(window).height();
const composerHeight = $("#reply-control").height() || 0;
const isDocked = offset >= maximumOffset - windowHeight + composerHeight;
const bottom = $("#main").height() - maximumOffset;
if (composerHeight > 0) {
$wrapper.css("bottom", isDocked ? bottom : composerHeight);
} else {
$wrapper.css("bottom", isDocked ? bottom : "");
}
this.set("docked", isDocked);
const $replyArea = $("#reply-control .reply-area");
if ($replyArea && $replyArea.length > 0) {
$wrapper.css("right", `${$replyArea.offset().left}px`);
} else {
$wrapper.css("right", "1em");
}
},
I have proven to myself that, in my case, changing
const bottom = $("#main").height() - maximumOffset;
to
const bottom = $("body").height() - maximumOffset;
works perfectly for our site.
I can imagine that you may want to not presume the body element selector would work in all cases so a perhaps more elegant solution would be to wrap the theme (brand?) header in a div that could be selected such that you could replace the bottom calculation with something like:
const bottom = ((($("#brand_header").height() + $("#main").height()) - maximumOffset;
Suggestions? Where can we go from here?