{ this.$refs.dialog?.focus(); }); } else if (this.previousFocus) { this.previousFocus.focus(); this.previousFocus = null; } }); }, trapTab(e) { if (e.key !== 'Tab') return; e.preventDefault(); if (!this.focusableElements || this.focusableElements.length === 0) return; const currentIndex = Array.from(this.focusableElements).indexOf(document.activeElement); if (e.shiftKey) { const prevIndex = (currentIndex - 1 + this.focusableElements.length) % this.focusableElements.length; this.focusableElements[prevIndex]?.focus(); } else { const nextIndex = (currentIndex + 1) % this.focusableElements.length; this.focusableElements[nextIndex]?.focus(); } } }" @keydown.tab.window="trapTab" @open-modal.window="if ($event.detail.id === '{{ id }}') show = true" @close-modal.window="if ($event.detail.id === '{{ id }}') show = false" @keydown.escape.window="show = false" class="relative z-50" >