From 9719454ea19359781e01228f2fab26435542da65 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sun, 6 Oct 2024 20:10:02 +0700 Subject: [PATCH] Fix not hiding Stream menu's grip handle sometimes --- src/modules/stream/stream-ui.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/modules/stream/stream-ui.ts b/src/modules/stream/stream-ui.ts index 958a582..bc36b05 100644 --- a/src/modules/stream/stream-ui.ts +++ b/src/modules/stream/stream-ui.ts @@ -135,12 +135,6 @@ export class StreamUiHandler { } private static handleSystemMenu($streamHud: HTMLElement) { - // Grip handle - const $gripHandle = $streamHud.querySelector('button[class^=GripHandle]') as HTMLElement; - if (!$gripHandle) { - return; - } - // Get the last button const $orgButton = $streamHud.querySelector('div[class^=HUDButton]') as HTMLElement; if (!$orgButton) { @@ -148,14 +142,11 @@ export class StreamUiHandler { } const hideGripHandle = () => { - if (!$gripHandle) { - return; + // Grip handle + const $gripHandle = document.querySelector('#StreamHud button[class^=GripHandle]') as HTMLElement; + if ($gripHandle && $gripHandle.ariaExpanded === 'true') { + $gripHandle.click(); } - - $gripHandle.dispatchEvent(new PointerEvent('pointerdown')); - $gripHandle.click(); - $gripHandle.dispatchEvent(new PointerEvent('pointerdown')); - $gripHandle.click(); } // Create Stream Settings button