@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teammodlr/ui-kit",
3
- "version": "3.0.0-beta.20",
3
+ "version": "3.0.0-beta.21",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs.js",
6
6
  "module": "lib/index.es.js",
@@ -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(