mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
fix: close keyframe bypasses on protected controls without policing skin layout
Hold @keyframes to the same hide/yeet checks as regular declarations, including escaped and namespaced animation names. Loosen decorative host-chrome layout locks so open skins can restyle layout freely. Listen for the recovery shortcut in the capture phase, move the load-failure banner into the host-owned layer, and fix recovery aria-labels.
This commit is contained in:
1 parent
a84f66b47d
commit
a4ae4de82f
9 files changed
+286
-57
No files matched your search
@@ -162,13 +162,16 @@ function openLibrary() {
|
||||
}
|
||||
|
||||
function onKeydown(event: KeyboardEvent) {
|
||||
if (event.defaultPrevented || event.repeat || !thirdPartyAllowed.value) return;
|
||||
if (event.repeat || !thirdPartyAllowed.value) return;
|
||||
// The recovery chord must survive a capture-phase preventDefault() from a
|
||||
// skin or plugin, so it runs before the defaultPrevented check below.
|
||||
if (isRecoveryShortcut(event)) {
|
||||
event.preventDefault();
|
||||
shortcutOpen.value = true;
|
||||
void nextTick(() => recoveryPopover.value?.querySelector("button")?.focus());
|
||||
return;
|
||||
}
|
||||
if (event.defaultPrevented) return;
|
||||
if (event.key === "Escape" && shortcutOpen.value) shortcutOpen.value = false;
|
||||
}
|
||||
|
||||
@@ -184,13 +187,13 @@ onMounted(() => {
|
||||
refreshLauncherReachability();
|
||||
reachabilityTimer = setInterval(refreshLauncherReachability, 1000);
|
||||
window.addEventListener("resize", refreshLauncherReachability);
|
||||
window.addEventListener("keydown", onKeydown);
|
||||
window.addEventListener("keydown", onKeydown, true);
|
||||
void nextTick(syncPopover);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
if (reachabilityTimer) clearInterval(reachabilityTimer);
|
||||
window.removeEventListener("resize", refreshLauncherReachability);
|
||||
window.removeEventListener("keydown", onKeydown);
|
||||
window.removeEventListener("keydown", onKeydown, true);
|
||||
layer?.dispose();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Teleport v-if="layer" :to="layer.container">
|
||||
<section v-if="error" class="skin-load-recovery" data-ws-part="app.skin-load-recovery" role="alert">
|
||||
<p>{{ labels.skinLoadError(error.skinId) }}</p>
|
||||
<button type="button" @click="$emit('use-built-in')">{{ labels.skinUseBuiltIn }}</button>
|
||||
@@ -8,9 +8,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { computed, onBeforeUnmount } from "vue";
|
||||
import type { Language } from "../i18n/web-client.js";
|
||||
import { resolveSkinLayoutLanguage, skinLayoutLabels } from "../i18n/skin-layout.js";
|
||||
import { createHostOwnedLayer, type HostOwnedLayer } from "../services/host-owned-layer.js";
|
||||
|
||||
defineEmits<{ "use-built-in": [] }>();
|
||||
|
||||
@@ -19,9 +20,11 @@ const props = defineProps<{
|
||||
language: Language;
|
||||
}>();
|
||||
const labels = computed(() => skinLayoutLabels[resolveSkinLayoutLanguage(props.language)]);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
// The banner is trusted host UI: render it in a closed shadow root so compiled
|
||||
// skin CSS cannot restyle it (or hide it) from the document. The layer's fixed
|
||||
// wrapper is pointer-transparent, so the banner re-enables pointer events.
|
||||
const SKIN_LOAD_LAYER_CSS = `
|
||||
.skin-load-recovery {
|
||||
position: fixed;
|
||||
z-index: 2147482500;
|
||||
@@ -40,13 +43,18 @@ const labels = computed(() => skinLayoutLabels[resolveSkinLayoutLanguage(props.l
|
||||
background: #fffbeb;
|
||||
box-shadow: 0 8px 28px #0f172a33;
|
||||
font: 14px/1.45 ui-sans-serif, system-ui, sans-serif;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.skin-load-recovery p { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
|
||||
.skin-load-recovery button { flex: 0 0 auto; min-height: 44px; max-width: 100%; padding: 7px 10px; border: 1px solid #b45309; border-radius: 8px; color: #78350f; background: #fff; cursor: pointer; white-space: normal; }
|
||||
.skin-load-recovery button:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
|
||||
|
||||
@media (max-width: 520px) {
|
||||
.skin-load-recovery { align-items: stretch; flex-direction: column; gap: 7px; }
|
||||
.skin-load-recovery button { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
|
||||
const layer: HostOwnedLayer | null = createHostOwnedLayer("skin-load", SKIN_LOAD_LAYER_CSS);
|
||||
|
||||
onBeforeUnmount(() => layer?.dispose());
|
||||
</script>
|
||||
@@ -4,7 +4,7 @@ import type { SiteLanguage } from "../../../src/site-copy.js";
|
||||
const en = {
|
||||
hint: "Audio controls remain available in the toolbar and voice workspace.",
|
||||
library: "Application library",
|
||||
recovery: "Restore application library",
|
||||
recovery: "Restore built-in skin",
|
||||
useBuiltIn: "Use built-in skin",
|
||||
shortcut: "Restore the built-in skin (Ctrl+Alt+Shift+R, or ⌘+⌥+⇧+R on macOS)",
|
||||
};
|
||||
@@ -13,28 +13,28 @@ export const hostChromeCopy: Record<SiteLanguage, typeof en> = {
|
||||
zh: {
|
||||
hint: "音频控制始终保留在工具栏和语音工作区中。",
|
||||
library: "应用库",
|
||||
recovery: "恢复应用库",
|
||||
recovery: "恢复内置皮肤",
|
||||
useBuiltIn: "使用内置皮肤",
|
||||
shortcut: "恢复内置皮肤(Ctrl+Alt+Shift+R,macOS 为 ⌘+⌥+⇧+R)",
|
||||
},
|
||||
de: {
|
||||
hint: "Audiosteuerung bleibt in der Werkzeugleiste und im Sprachbereich verfügbar.",
|
||||
library: "Anwendungsbibliothek",
|
||||
recovery: "Anwendungsbibliothek wiederherstellen",
|
||||
recovery: "Integrierten Skin wiederherstellen",
|
||||
useBuiltIn: "Integrierten Skin verwenden",
|
||||
shortcut: "Integrierten Skin wiederherstellen (Strg+Alt+Umschalt+R, unter macOS ⌘+⌥+⇧+R)",
|
||||
},
|
||||
ru: {
|
||||
hint: "Управление звуком остаётся доступным на панели инструментов и в голосовой области.",
|
||||
library: "Библиотека приложений",
|
||||
recovery: "Восстановить библиотеку приложений",
|
||||
recovery: "Восстановить встроенную тему",
|
||||
useBuiltIn: "Использовать встроенную тему",
|
||||
shortcut: "Восстановить встроенную тему (Ctrl+Alt+Shift+R, в macOS ⌘+⌥+⇧+R)",
|
||||
},
|
||||
ja: {
|
||||
hint: "音声コントロールはツールバーと音声ワークスペースで常に利用できます。",
|
||||
library: "アプリライブラリ",
|
||||
recovery: "アプリライブラリを復元",
|
||||
recovery: "組み込みスキンを復元",
|
||||
useBuiltIn: "組み込みスキンを使用",
|
||||
shortcut: "組み込みスキンを復元(Ctrl+Alt+Shift+R、macOS は ⌘+⌥+⇧+R)",
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* without the Popover API still shows the UI above ordinary content.
|
||||
*/
|
||||
|
||||
export type HostOwnedLayerName = "recovery" | "authorization";
|
||||
export type HostOwnedLayerName = "recovery" | "authorization" | "skin-load";
|
||||
|
||||
/**
|
||||
* The CSS 32-bit maximum stacking value. A compiled skin may legitimately use
|
||||
|
||||
Reference in new issue
Block a user