diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-12-01 08:21:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-01 08:21:30 +0900 |
| commit | e1b6e9d4b6fd261a4d38c4760d8bc5dcd43b35fe (patch) | |
| tree | 24bba8556cb3efdbca8a96bbc3233d775719e0a4 /packages/frontend/src | |
| parent | chore(deps): update [misskey-js] update dependencies [ci skip] (#16900) (diff) | |
| download | misskey-e1b6e9d4b6fd261a4d38c4760d8bc5dcd43b35fe.tar.gz misskey-e1b6e9d4b6fd261a4d38c4760d8bc5dcd43b35fe.tar.bz2 misskey-e1b6e9d4b6fd261a4d38c4760d8bc5dcd43b35fe.zip | |
fix(frontend): visibilityStateがhiddenな状態でstartViewTransitionしないように
Diffstat (limited to 'packages/frontend/src')
| -rw-r--r-- | packages/frontend/src/theme.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/frontend/src/theme.ts b/packages/frontend/src/theme.ts index fc3f5f55f2..e001bed8f3 100644 --- a/packages/frontend/src/theme.ts +++ b/packages/frontend/src/theme.ts @@ -144,7 +144,9 @@ export function applyTheme(theme: Theme, persist = true) { if (theme.id === currentThemeId && miLocalStorage.getItem('themeCachedVersion') === version) return; currentThemeId = theme.id; - if (window.document.startViewTransition != null) { + // visibilityStateがhiddenな状態でstartViewTransitionするとブラウザによってはエラーになる + // 通常hiddenな時に呼ばれることはないが、iOSのPWAだとアプリ切り替え時に(何故か)hiddenな状態で(何故か)一瞬デバイスのダークモード判定が変わりapplyThemeが呼ばれる場合がある + if (window.document.startViewTransition != null && window.document.visibilityState === 'visible') { window.document.documentElement.classList.add('_themeChanging_'); try { window.document.startViewTransition(async () => { |