Skip to content

Commit

Permalink
REFACTOR: removes self pattern from safari-hacks lib (#7795)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux committed Jun 24, 2019
1 parent e064db3 commit c1ca942
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/assets/javascripts/discourse/lib/safari-hacks.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,15 @@ function positioningWorkaround($fixedElement) {
var blurred = debounce(blurredNow, 250);

var positioningHack = function(evt) {
const self = this;
done = false;

// we need this, otherwise changing focus means we never clear
self.addEventListener("blur", blurred);
this.addEventListener("blur", blurred);

if (fixedElement.style.top === "0px") {
if (this !== document.activeElement) {
evt.preventDefault();
self.focus();
this.focus();
}
return;
}
Expand Down Expand Up @@ -157,7 +156,7 @@ function positioningWorkaround($fixedElement) {
$(fixedElement).addClass("no-transition");

evt.preventDefault();
self.focus();
this.focus();
workaroundActive = true;
};

Expand Down

0 comments on commit c1ca942

Please sign in to comment.