FIX: Prevent Safari from scrolling when closing composer

FIX: Prevent Safari from scrolling when closing composer

Unlike other browsers, Safari maintains focus on elements even when they are hidden. And since the composer is fixed-positioned when hidden, closing the composer on a topic with several replies causes Safari to scroll the window up.

Deliberately blurring the focused element fixes the issue.

diff --git a/app/assets/javascripts/discourse/app/controllers/composer.js b/app/assets/javascripts/discourse/app/controllers/composer.js
index d8aed92..c589c7f 100644
--- a/app/assets/javascripts/discourse/app/controllers/composer.js
+++ b/app/assets/javascripts/discourse/app/controllers/composer.js
@@ -1162,6 +1162,7 @@ export default Controller.extend({
     const elem = document.querySelector("html");
     elem.classList.remove("fullscreen-composer");
 
+    document.activeElement.blur();
     this.setProperties({ model: null, lastValidatedAt: null });
   },
 

GitHub sha: ad7c964c