fix(findSP): fallback to last active context (#53)

This commit is contained in:
Lukas Senionis
2022-12-11 22:01:41 +02:00
committed by GitHub
parent bb291b211c
commit 6f14da152a
2 changed files with 4 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ export function findSP(): Window {
// old (SP as host)
if (document.title == 'SP') return window;
// new (SP as popup)
return FocusNavController.m_ActiveContext.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
const context = FocusNavController.m_ActiveContext || FocusNavController.m_LastActiveContext;
return context.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
.Element.ownerDocument.defaultView;
}