diff --git a/framework/core/js/src/forum/components/AffixedSidebar.js b/framework/core/js/src/forum/components/AffixedSidebar.js index 3cba6e88ef..dbf0750d43 100644 --- a/framework/core/js/src/forum/components/AffixedSidebar.js +++ b/framework/core/js/src/forum/components/AffixedSidebar.js @@ -1,15 +1,23 @@ import Component from '../../common/Component'; /** - * The `AffixedSidebar` component uses Bootstrap's "affix" plugin to keep a + * Calculate the height of element with margin. + * @param {HTMLElement} element The element. + * @returns {number} The height of element with margin. + */ +function heightWithMargin(element) { + const style = getComputedStyle(element); + return element.getBoundingClientRect().height + parseInt(style.marginBottom, 10) + parseInt(style.marginTop, 10); +} + +/** + * The `AffixedSidebar` component uses sticky position to keep a * sidebar navigation at the top of the viewport when scrolling. * * ### Children * * The component must wrap an element that itself wraps an