diff --git a/app/assets/javascripts/discourse/app/components/site-header.js b/app/assets/javascripts/discourse/app/components/site-header.js index 01dd38728a0..8490dec6394 100644 --- a/app/assets/javascripts/discourse/app/components/site-header.js +++ b/app/assets/javascripts/discourse/app/components/site-header.js @@ -486,7 +486,7 @@ export default SiteHeaderComponent.extend({ this._resizeObserver = new ResizeObserver((entries) => { for (let entry of entries) { if (entry.contentRect) { - const headerTop = this.header.offsetTop; + const headerTop = this.header?.offsetTop; document.documentElement.style.setProperty( "--header-top", `${headerTop}px`