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.
This commit is contained in:
Penar Musaraj 2020-05-13 21:24:40 -04:00
parent 732776e2ce
commit ad7c964cd1
1 changed files with 1 additions and 0 deletions

View File

@ -1162,6 +1162,7 @@ export default Controller.extend({
const elem = document.querySelector("html"); const elem = document.querySelector("html");
elem.classList.remove("fullscreen-composer"); elem.classList.remove("fullscreen-composer");
document.activeElement.blur();
this.setProperties({ model: null, lastValidatedAt: null }); this.setProperties({ model: null, lastValidatedAt: null });
}, },