FIX: selection going missing in Safari (#14557)

This commit is contained in:
Penar Musaraj 2021-10-07 14:55:38 -04:00 committed by GitHub
parent e68dc0c598
commit 538fe2cc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -206,13 +206,6 @@ export default Component.extend(KeyEnterEscape, {
// merge back all text nodes so they don't get messed up
parent.normalize();
// work around Safari that would sometimes lose the selection
if (isSafari) {
this._reselected = true;
selection.removeAllRanges();
selection.addRange(clone);
}
// change the position of the button
schedule("afterRender", () => {
if (!this.element || this.isDestroying || this.isDestroyed) {
@ -234,6 +227,13 @@ export default Component.extend(KeyEnterEscape, {
$quoteButton.offset({ top, left });
this.element.querySelector("button")?.focus();
// work around Safari that would sometimes lose the selection
if (isSafari) {
this._reselected = true;
selection.removeAllRanges();
selection.addRange(clone);
}
});
},