FIX: Broken quick search on iPadOS (#14663)

FIX: Broken quick search on iPadOS (#14663)

This also reverts back to selecting the search input text when reopening the search panel.

diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js
index db23ceb..e92f8ac 100644
--- a/app/assets/javascripts/discourse/app/widgets/header.js
+++ b/app/assets/javascripts/discourse/app/widgets/header.js
@@ -7,7 +7,6 @@ import { createWidget } from "discourse/widgets/widget";
 import getURL from "discourse-common/lib/get-url";
 import { h } from "virtual-dom";
 import { iconNode } from "discourse-common/lib/icon-library";
-import putCursorAtEnd from "discourse/lib/put-cursor-at-end";
 import { schedule } from "@ember/runloop";
 import { scrollTop } from "discourse/mixins/scroll-top";
 import { wantsNewWindow } from "discourse/lib/intercept-click";
@@ -626,7 +625,9 @@ export default createWidget("header", {
   focusSearchInput() {
     if (this.state.searchVisible) {
       schedule("afterRender", () => {
-        putCursorAtEnd(document.querySelector("#search-term"));
+        const searchInput = document.querySelector("#search-term");
+        searchInput.focus();
+        searchInput.select();
       });
     }
   },

GitHub sha: 3e86ec3e4ec669efca2515ae171bde4d6014bb87

This commit appears in #14663 which was approved by nbianca and ZogStriP. It was merged by pmusaraj.