diff --git a/src/modules/game-bar/game-bar.ts b/src/modules/game-bar/game-bar.ts index b7be891..5a966b1 100644 --- a/src/modules/game-bar/game-bar.ts +++ b/src/modules/game-bar/game-bar.ts @@ -1,4 +1,4 @@ -import { CE, createSvgIcon } from "@utils/html"; +import { CE, clearFocus, createSvgIcon } from "@utils/html"; import { ScreenshotAction } from "./action-screenshot"; import { TouchControlAction } from "./action-touch-control"; import { BxEvent } from "@utils/bx-event"; @@ -133,6 +133,9 @@ export class GameBar { } hideBar() { + // Stop focusing Game Bar + clearFocus(); + if (!this.$container) { return; } diff --git a/src/utils/html.ts b/src/utils/html.ts index 9a7b6c6..10a436d 100644 --- a/src/utils/html.ts +++ b/src/utils/html.ts @@ -174,3 +174,9 @@ export function removeChildElements($parent: HTMLElement) { $parent.firstElementChild.remove(); } } + +export function clearFocus() { + if (document.activeElement instanceof HTMLElement) { + document.activeElement.blur(); + } +}