@teammodlr/ui-kit 3.0.0-beta.21 → 3.0.0-beta.22

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.21",
3
+ "version": "3.0.0-beta.22",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs.js",
6
6
  "module": "lib/index.es.js",
@@ -65,7 +65,6 @@ import {
65
65
  import {
66
66
  computed,
67
67
  defineComponent,
68
- onUnmounted,
69
68
  provide,
70
69
  ref,
71
70
  shallowRef,
@@ -140,17 +139,6 @@ export default defineComponent({
140
139
  const focusTrapOverride = ref<boolean | null>(null);
141
140
  const activeFocusTrap = computed(() => focusTrapOverride.value ?? props.focusTrap);
142
141
 
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
-
154
142
  const isDragging = ref<boolean>(false);
155
143
 
156
144
  function resolveElement(
@@ -365,6 +353,14 @@ export default defineComponent({
365
353
 
366
354
  function setFocusTrap(value: boolean) {
367
355
  focusTrapOverride.value = value;
356
+ const el = dialogElement.value;
357
+ if (el) {
358
+ if (value) {
359
+ el.removeAttribute('inert');
360
+ } else {
361
+ el.setAttribute('inert', '');
362
+ }
363
+ }
368
364
  }
369
365
 
370
366
  expose({