shared-ritm 1.1.99 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-ritm",
3
- "version": "1.1.99",
3
+ "version": "1.2.1",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -43,7 +43,7 @@
43
43
  </template>
44
44
 
45
45
  <script setup lang="ts">
46
- import { computed, defineEmits, defineProps, withDefaults } from 'vue'
46
+ import { computed, defineEmits, defineProps, nextTick, onMounted, ref, withDefaults } from 'vue'
47
47
 
48
48
  interface DialogProps {
49
49
  dialogRef: any
@@ -74,6 +74,30 @@ const DialogRef = computed({
74
74
  emit('update:dialogRef', value)
75
75
  },
76
76
  })
77
+
78
+ function patchDialogFocus(rootEl: HTMLElement) {
79
+ // Переопределяем метод .focus() у элемента
80
+ rootEl.focus = () => {}
81
+
82
+ // Удаляем все автофокусы, чтобы они не триггерили фокусные ловушки
83
+ const autofocusElements = rootEl.querySelectorAll('[autofocus], [data-autofocus]')
84
+ autofocusElements.forEach(el => {
85
+ el.removeAttribute('autofocus')
86
+ el.removeAttribute('data-autofocus')
87
+ })
88
+ }
89
+
90
+ onMounted(async () => {
91
+ await nextTick()
92
+
93
+ const el = DialogRef.value?.$el ?? DialogRef.value
94
+ if (!el) return
95
+
96
+ const dialogEl = el.closest('.q-dialog')
97
+ if (dialogEl instanceof HTMLElement) {
98
+ patchDialogFocus(dialogEl)
99
+ }
100
+ })
77
101
  </script>
78
102
 
79
103
  <style>