fix(voice): improve performance panel dismissal

This commit is contained in:
illusia committed 2026-10-11 03:53:14 +08:00
1 parent 3ff6507943
commit deb5ca4e43
9 files changed
+76 -21

No files matched your search

@@ -1,9 +1,11 @@
<template>
<div
ref="root"
class="network-performance"
data-ws-part="voice.performance"
>
<button
ref="trigger"
type="button"
class="performance-trigger"
:title="t('voiceStatus')"
@@ -18,14 +20,15 @@
name="chevron-down"
:size="13"
/></button>
<section
v-if="performancePanelOpen"
class="performance-panel"
data-ws-part="voice.performance.panel"
role="dialog"
:aria-label="t('voiceStatus')"
@click.stop
>
<Transition name="voice-performance-panel">
<section
v-if="performancePanelOpen"
class="performance-panel"
data-ws-part="voice.performance.panel"
role="dialog"
:aria-label="t('voiceStatus')"
@click.stop
>
<header
><div
><strong>{{ t("voiceStatus") }}</strong
@@ -209,18 +212,21 @@
>
</div>
</section>
</section>
</section>
</Transition>
</div>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
import Icon from "../Icon.vue";
import type { useWebClientPerformance } from "../../composables/useWebClientPerformance.js";
import type { ScreenShareWebRtcStats } from "../../composables/useVoiceWebSocket.js";
const props = defineProps<{ model: ReturnType<typeof useWebClientPerformance>; screenShareWebRtcStats: ScreenShareWebRtcStats; showScreenShare?: boolean; t: (key: string) => string }>();
const showScreenShare = props.showScreenShare !== false;
const { panelOpen: performancePanelOpen, running: performanceRunning, stats: performanceStats, togglePanel: togglePerformancePanel, refresh: refreshPerformanceProbe } = props.model;
const root = ref<HTMLElement | null>(null);
const trigger = ref<HTMLButtonElement | null>(null);
const t = props.t;
const voiceHealthLabel = computed(() => t(({ disconnected: "voiceHealthDisconnected", sampling: "voiceHealthSampling", connecting: "voiceHealthConnecting", warning: "voiceHealthWarning", active: "voiceHealthActive", quiet: "voiceHealthQuiet" } as const)[performanceStats.value.health]));
const voiceTransportLabel = computed(() => t(({ webrtc: "voiceTransportWebRTC", websocket: "voiceTransportWebSocket", negotiating: "voiceTransportNegotiating", disconnected: "voiceTransportDisconnected" } as const)[performanceStats.value.transport]));
@@ -233,4 +239,28 @@ const voiceMicrophoneLabel = computed(() => performanceStats.value.microphoneMut
? t("voiceMicUnavailable")
: t("voiceMicWaiting"));
function onOutsidePointerDown(event: PointerEvent): void {
if (performancePanelOpen.value && !root.value?.contains(event.target as Node)) {
togglePerformancePanel();
}
}
function onEscape(event: KeyboardEvent): void {
if (!performancePanelOpen.value || event.key !== "Escape") return;
event.preventDefault();
event.stopPropagation();
togglePerformancePanel();
void nextTick(() => trigger.value?.focus());
}
onMounted(() => {
document.addEventListener("pointerdown", onOutsidePointerDown, true);
document.addEventListener("keydown", onEscape, true);
});
onBeforeUnmount(() => {
document.removeEventListener("pointerdown", onOutsidePointerDown, true);
document.removeEventListener("keydown", onEscape, true);
});
</script>
+2 -2
View File
@@ -46,10 +46,10 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
{
id: BUILTIN_KAAK_SKIN_ID,
name: "KAAK",
version: "3.1.33",
version: "3.1.34",
author: "WebSpeak Project",
license: "AGPL-3.0-only",
description: "A KOOK-inspired voice-room workspace with collapsible voice groups and current voice-channel chat, TeamSpeak profile cards, and host-owned voice controls.",
description: "A KOOK-inspired voice-room workspace with collapsible voice groups, current voice-channel chat, TeamSpeak profile cards, and accessible host-owned voice controls.",
minAppVersion: "0.2.7-preview",
installedAt: 0,
builtIn: true,
+4 -1
View File
@@ -464,7 +464,7 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
const file = new File([archive], "kaak-voice.wskin", { type: "application/octet-stream" });
const skin = await importSkinPack(file);
assert.equal(skin.id, "community.kaak-voice");
assert.equal(skin.version, "3.1.33");
assert.equal(skin.version, "3.1.34");
assert.equal(BUILTIN_SKIN_CATALOG.find((entry) => entry.id === skin.id)?.version, skin.version);
assert.equal(skin.schemaVersion, 3);
const home = skin.pluginData?.components.find((component) => component.page === "home");
@@ -553,6 +553,9 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
assert.match(skin.css, /--skin-kaak-font:[\s\S]*?PingFang SC/);
assert.match(skin.css, /settings-select-menu[\s\S]*?background: #35373d/);
assert.match(skin.css, /settings-select-option[\s\S]*?min-height: 32px/);
assert.match(skin.css, /voice-performance-panel-enter-active[\s\S]*?transition: opacity \.16s/);
assert.match(skin.css, /voice-performance-panel-leave-active/);
assert.match(skin.css, /voice-performance-panel-enter-from,[\s\S]*?voice-performance-panel-leave-to \{\s*opacity: 0;/);
assert.match(skin.css, /kaak-workspace\.voice-channel-group-toggle/);
assert.match(skin.css, /voice-channel-list[\s\S]*?grid-template-rows: 1fr;[\s\S]*?transition: grid-template-rows \.18s ease/);
assert.match(skin.css, /data-voice-group-open="false"[\s\S]*?voice-channel-list[\s\S]*?grid-template-rows: 0fr;[\s\S]*?visibility: hidden;[\s\S]*?visibility 0s linear \.18s/);