prevent auto-scroll when focus is set inside header panels

prevent auto-scroll when focus is set inside header panels

diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js
index 8adbe4d..3e6b096 100644
--- a/app/assets/javascripts/discourse/app/widgets/header.js
+++ b/app/assets/javascripts/discourse/app/widgets/header.js
@@ -484,7 +484,9 @@ export default createWidget("header", {
 
     // auto focus on first button in dropdown
     schedule("afterRender", () =>
-      document.querySelector(".user-menu button")?.focus()
+      document.querySelector(".user-menu button")?.focus({
+        preventScroll: true,
+      })
     );
   },
 
@@ -494,7 +496,9 @@ export default createWidget("header", {
 
     // auto focus on first link in dropdown
     schedule("afterRender", () => {
-      document.querySelector(".hamburger-panel .menu-links a")?.focus();
+      document.querySelector(".hamburger-panel .menu-links a")?.focus({
+        preventScroll: true,
+      });
     });
   },
 
@@ -624,7 +628,9 @@ export default createWidget("header", {
     if (this.state.searchVisible) {
       schedule("afterRender", () => {
         const searchInput = document.querySelector("#search-term");
-        searchInput.focus();
+        searchInput.focus({
+          preventScroll: true,
+        });
         searchInput.select();
       });
     }

GitHub sha: f444e3e3f704ef71c29d57461018b3a292ef905f

This commit appears in #14822 which was approved by eviltrout. It was merged by eviltrout.