mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 12:02:50 +08:00
fix(skin): repair host recovery compatibility and placement
Align the toolbar example with its first compatible runtime, restore recovery after shortcut focus leaves, and harden observer scheduling, contrast, floating avoidance, and private selector validation.
This commit is contained in:
1 parent
df826f575e
commit
4e8ea3081c
17 files changed
+453
-23
No files matched your search
+37
-2
@@ -16,6 +16,7 @@
|
||||
#home-anchor { left: 20px; }
|
||||
#voice-anchor { left: 20px; display: none; }
|
||||
#dock { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; }
|
||||
#blank { position: absolute; left: 20px; top: 100px; padding: 12px; background: #fff; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -34,6 +35,7 @@
|
||||
<button type="button" data-ws-part="voice.audio-dock.microphone">Mic</button>
|
||||
</div>
|
||||
<button type="button" id="launcher" data-ws-part="host.plugins.launcher">Plugins</button>
|
||||
<div id="blank" tabindex="-1">Blank area</div>
|
||||
</div>
|
||||
<div id="app"></div>
|
||||
<pre id="result" style="position:relative;z-index:5;background:#fff">pending</pre>
|
||||
@@ -209,7 +211,7 @@ try {
|
||||
capsuleActions: [...(capsule()?.querySelectorAll("[data-ws-recovery-action]") ?? [])]
|
||||
.map((button) => button.getAttribute("data-ws-recovery-action")),
|
||||
};
|
||||
capsule().dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
||||
layer.shadow.activeElement?.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true, composed: true }));
|
||||
await nextTick();
|
||||
await sleep(150);
|
||||
const afterEscape = {
|
||||
@@ -235,7 +237,7 @@ try {
|
||||
capsuleActions: [...(capsule()?.querySelectorAll("[data-ws-recovery-action]") ?? [])]
|
||||
.map((button) => button.getAttribute("data-ws-recovery-action")),
|
||||
};
|
||||
capsule().dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
||||
layer.shadow.activeElement?.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true, composed: true }));
|
||||
await nextTick();
|
||||
await sleep(150);
|
||||
const afterMacEscape = {
|
||||
@@ -243,6 +245,37 @@ try {
|
||||
toolbarOpen: isOpen(toolbar()),
|
||||
};
|
||||
|
||||
window.dispatchEvent(new KeyboardEvent("keydown", {
|
||||
key: "r", ctrlKey: true, altKey: true, shiftKey: true, bubbles: true, cancelable: true,
|
||||
}));
|
||||
await nextTick();
|
||||
await sleep(80);
|
||||
document.getElementById("blank").focus();
|
||||
await nextTick();
|
||||
await sleep(150);
|
||||
const afterFocusOut = {
|
||||
focusedAction: layer.shadow.activeElement?.getAttribute?.("data-ws-recovery-action") ?? null,
|
||||
activeId: document.activeElement?.id ?? null,
|
||||
capsuleOpen: isOpen(capsule()),
|
||||
toolbarOpen: isOpen(toolbar()),
|
||||
};
|
||||
|
||||
window.dispatchEvent(new KeyboardEvent("keydown", {
|
||||
key: "r", ctrlKey: true, altKey: true, shiftKey: true, bubbles: true, cancelable: true,
|
||||
}));
|
||||
await nextTick();
|
||||
await sleep(80);
|
||||
const blank = document.getElementById("blank");
|
||||
blank.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, composed: true, pointerType: "mouse" }));
|
||||
blank.dispatchEvent(new MouseEvent("click", { bubbles: true, composed: true }));
|
||||
await nextTick();
|
||||
await sleep(150);
|
||||
const afterBlankClick = {
|
||||
activeId: document.activeElement?.id ?? null,
|
||||
capsuleOpen: isOpen(capsule()),
|
||||
toolbarOpen: isOpen(toolbar()),
|
||||
};
|
||||
|
||||
// Invalid / unreadable toolbar tokens must not make the button invisible.
|
||||
const voiceAnchor = document.getElementById("voice-anchor");
|
||||
voiceAnchor.style.setProperty("--skin-recovery-toolbar-background", "rgba(0,0,0,0)");
|
||||
@@ -270,6 +303,8 @@ try {
|
||||
afterEscape,
|
||||
macShortcut,
|
||||
afterMacEscape,
|
||||
afterFocusOut,
|
||||
afterBlankClick,
|
||||
invalidTokens,
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user