@teammodlr/ui-kit 3.0.0-beta.20 → 3.0.0-beta.21
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/lib/index.cjs.js +3 -3
- package/lib/index.es.js +820 -816
- package/package.json +1 -1
- package/src/components/dialog/Dialog.vue +12 -0
package/package.json
CHANGED
|
@@ -65,6 +65,7 @@ import {
|
|
|
65
65
|
import {
|
|
66
66
|
computed,
|
|
67
67
|
defineComponent,
|
|
68
|
+
onUnmounted,
|
|
68
69
|
provide,
|
|
69
70
|
ref,
|
|
70
71
|
shallowRef,
|
|
@@ -139,6 +140,17 @@ export default defineComponent({
|
|
|
139
140
|
const focusTrapOverride = ref<boolean | null>(null);
|
|
140
141
|
const activeFocusTrap = computed(() => focusTrapOverride.value ?? props.focusTrap);
|
|
141
142
|
|
|
143
|
+
// reka-ui's FocusScope captures `trapped` at mount time and never re-checks it.
|
|
144
|
+
// We register this listener before FocusScope mounts (children mount after parent setup)
|
|
145
|
+
// so it fires first and blocks reka-ui's listener from stealing focus when trap is off.
|
|
146
|
+
const focusTrapBlocker = (event: FocusEvent) => {
|
|
147
|
+
if (!activeFocusTrap.value) {
|
|
148
|
+
event.stopImmediatePropagation();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
document.addEventListener('focusin', focusTrapBlocker, true);
|
|
152
|
+
onUnmounted(() => document.removeEventListener('focusin', focusTrapBlocker, true));
|
|
153
|
+
|
|
142
154
|
const isDragging = ref<boolean>(false);
|
|
143
155
|
|
|
144
156
|
function resolveElement(
|