mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Tighten the render failure notice's error handling and focus
- An error a frame of the inline panel's timer throws no longer reaches the host page; it has been raised as a render error by then. - An error Scene raised and threw on (rethrowRenderErrors) is raised once. - After a lost context, later render errors are only logged, so the notice keeps saying why. - A render error without a value shows no detail. - The globe's tile load progress and the scene's tileset load events are finished too when a listener's error cuts them short. - Focus goes back where it was when the globe draws again, or to the map. - The appearance counter and the guard for a missing viewer are gone. Tests cover every finished event, a thrown timer frame, a single report under rethrowRenderErrors and the focus return; the inline tests share one setup.
This commit is contained in:
1 parent
265074aa54
commit
ebaa439739
12 files changed
+459
-416
No files matched your search
@@ -18,13 +18,33 @@ const MESSAGES = {
|
||||
),
|
||||
};
|
||||
// Focus moves to the first action each time the notice appears, so a
|
||||
// keyboard user can act on it at once.
|
||||
// keyboard user can act on it at once. When the globe draws again, it goes
|
||||
// back where it was, or to the map if that is gone, unless the user has moved
|
||||
// it since.
|
||||
let focusBefore;
|
||||
watch(
|
||||
() => failure.value?.shown,
|
||||
() => Boolean(failure.value),
|
||||
async (shown) => {
|
||||
if (!shown) return;
|
||||
if (shown) {
|
||||
focusBefore = document.activeElement;
|
||||
await nextTick();
|
||||
panel.value?.querySelector('button')?.focus();
|
||||
return;
|
||||
}
|
||||
if (focusBefore === undefined) return;
|
||||
const previous = focusBefore;
|
||||
focusBefore = undefined;
|
||||
await nextTick();
|
||||
panel.value?.querySelector('button')?.focus();
|
||||
const active = document.activeElement;
|
||||
if (active && active !== document.body) return;
|
||||
if (previous?.isConnected && previous !== document.body) {
|
||||
previous.focus();
|
||||
return;
|
||||
}
|
||||
const map = document.getElementById('cesiumContainer');
|
||||
if (!map) return;
|
||||
if (!map.hasAttribute('tabindex')) map.tabIndex = -1;
|
||||
map.focus();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user