From 98f3349c314463f69f26a207459ac21eb78bfeae Mon Sep 17 00:00:00 2001 From: awesomerobot Date: Thu, 31 Mar 2022 21:25:06 -0400 Subject: [PATCH] DEV: Safari's window.innerWidth doesn't match CSS --- .../discourse/app/components/topic-navigation.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/components/topic-navigation.js b/app/assets/javascripts/discourse/app/components/topic-navigation.js index 9c2b2ef70a2..a08444022c2 100644 --- a/app/assets/javascripts/discourse/app/components/topic-navigation.js +++ b/app/assets/javascripts/discourse/app/components/topic-navigation.js @@ -45,6 +45,11 @@ export default Component.extend(PanEvents, { let info = this.info; + // Safari's window.innerWidth doesn't match CSS media queries + let windowWidth = this.capabilities.isSafari + ? document.documentElement.clientWidth + : window.innerWidth; + if (info.get("topicProgressExpanded")) { info.set("renderTimeline", true); } else { @@ -55,7 +60,7 @@ export default Component.extend(PanEvents, { if (composer) { renderTimeline = - window.innerWidth > MIN_WIDTH_TIMELINE && + windowWidth > MIN_WIDTH_TIMELINE && window.innerHeight - composer.offsetHeight - headerOffset() > MIN_HEIGHT_TIMELINE; }