From 617916e8e5a8840f44309b4803f86f37180ddef1 Mon Sep 17 00:00:00 2001
From: AAGaming <aa@mail.catvibers.me>
Date: Sat, 1 Oct 2022 23:10:25 -0400
Subject: actually fix focus issue on startup

---
 frontend/src/toaster.tsx | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

(limited to 'frontend/src/toaster.tsx')

diff --git a/frontend/src/toaster.tsx b/frontend/src/toaster.tsx
index 3fe2e87e..2103da5f 100644
--- a/frontend/src/toaster.tsx
+++ b/frontend/src/toaster.tsx
@@ -46,15 +46,27 @@ class Toaster extends Logger {
       return false;
     });
 
-    const focusWorkaroundPatch = replacePatch(focusManager.prototype, 'BFocusWithin', function () {
+    const overrideFocus = function () {
       // @ts-ignore
-      if (this.m_node?.m_element && this.m_node?.m_element.classList.contains(staticClasses.TabGroupPanel)) {
+      self.debug(this.m_node.m_element);
+      // @ts-ignore
+      const classList = this.m_node?.m_element.classList;
+      if (
+        // @ts-ignore
+        (this.m_node?.m_element && classList.contains(staticClasses.TabGroupPanel)) ||
+        classList.contains('FriendsListTab') ||
+        classList.contains('FriendsTabList') ||
+        classList.contains('FriendsListAndChatsSteamDeck')
+      ) {
         self.debug('Intercepted friends re-focus');
         return true;
       }
 
       return callOriginal;
-    });
+    };
+
+    const focusWorkaroundPatch = replacePatch(focusManager.prototype, 'TakeFocus', overrideFocus);
+
     while (true) {
       instance = findInReactTree(
         (document.getElementById('root') as any)._reactRootContainer._internalRoot.current,
-- 
cgit v1.2.3

