mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: selection going missing in Safari (#14557)
This commit is contained in:
parent
e68dc0c598
commit
538fe2cc31
@ -206,13 +206,6 @@ export default Component.extend(KeyEnterEscape, {
|
|||||||
// merge back all text nodes so they don't get messed up
|
// merge back all text nodes so they don't get messed up
|
||||||
parent.normalize();
|
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
|
// change the position of the button
|
||||||
schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||||
@ -234,6 +227,13 @@ export default Component.extend(KeyEnterEscape, {
|
|||||||
$quoteButton.offset({ top, left });
|
$quoteButton.offset({ top, left });
|
||||||
|
|
||||||
this.element.querySelector("button")?.focus();
|
this.element.querySelector("button")?.focus();
|
||||||
|
|
||||||
|
// work around Safari that would sometimes lose the selection
|
||||||
|
if (isSafari) {
|
||||||
|
this._reselected = true;
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(clone);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user