[WV2] Fix Safari-specific bug for play/pause button state

This commit is contained in:
Emi Matchu 2026-02-05 19:03:17 -08:00
parent 97a035b3a3
commit ff3dd2249e

View file

@ -1,6 +1,7 @@
class OutfitViewer extends HTMLElement { class OutfitViewer extends HTMLElement {
#internals; #internals;
#isPlaying = true; // Track playing state internally (Safari CustomStateSet bug workaround) #isPlaying = true; // Track playing state internally (Safari CustomStateSet bug workaround)
#hasAnimations = false; // Track hasAnimations state internally (Safari CustomStateSet bug workaround)
constructor() { constructor() {
super(); super();
@ -64,12 +65,12 @@ class OutfitViewer extends HTMLElement {
this.querySelector("outfit-layer:state(has-animations)") !== null; this.querySelector("outfit-layer:state(has-animations)") !== null;
// Check if state actually changed // Check if state actually changed
const hadAnimations = this.#internals.states.has("has-animations"); if (hasAnimations === this.#hasAnimations) {
if (hasAnimations === hadAnimations) {
return; // No change, skip return; // No change, skip
} }
// Update internal state // Update internal state
this.#hasAnimations = hasAnimations;
if (hasAnimations) { if (hasAnimations) {
this.#internals.states.add("has-animations"); this.#internals.states.add("has-animations");
} else { } else {