FIX: ensures focus is dropped before focus hyperlink input (#10653)

FIX: ensures focus is dropped before focus hyperlink input (#10653)

diff --git a/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js b/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js
index a50a2c0..e560031 100644
--- a/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js
+++ b/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js
@@ -27,7 +27,7 @@ export default Controller.extend(ModalFunctionality, {
         .closest(".modal-inner-container")
         .addEventListener("mousedown", this.mouseDown);
 
-      document.querySelector("input.link-url").focus();
+      document.activeElement.blur();
     });
   },
 
diff --git a/app/assets/javascripts/discourse/app/lib/show-modal.js b/app/assets/javascripts/discourse/app/lib/show-modal.js
index a550b2f..f2602e0 100644
--- a/app/assets/javascripts/discourse/app/lib/show-modal.js
+++ b/app/assets/javascripts/discourse/app/lib/show-modal.js
@@ -1,4 +1,3 @@
-import { next } from "@ember/runloop";
 import I18n from "I18n";
 import { dasherize } from "@ember/string";
 import { getOwner } from "discourse-common/lib/get-owner";
@@ -73,7 +72,7 @@ export default function (name, opts) {
     controller.set("model", model);
   }
   if (controller.onShow) {
-    next(() => controller.onShow());
+    controller.onShow();
   }
   controller.set("flashMessage", null);
 
diff --git a/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbs b/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbs
index 6d6d45e..31e5c46 100644
--- a/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbs
+++ b/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbs
@@ -6,6 +6,7 @@
         placeholderKey="composer.link_url_placeholder"
         class="link-url"
         key-up=(action "search")
+        autofocus="autofocus"
       }}
       {{#if searchLoading}}
         {{loading-spinner}}

GitHub sha: 10bdf36a

This commit appears in #10653 which was merged by jjaffeux.