@octanejs/radix 0.1.46 → 0.1.48

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.
@@ -108,10 +108,11 @@ function FocusScope(props) {
108
108
  () => {
109
109
  if (!container) return;
110
110
  focusScopesStack.add(focusScope);
111
+ const OwnerCustomEvent = container.ownerDocument.defaultView?.CustomEvent ?? CustomEvent;
111
112
  const previouslyFocusedElement = document.activeElement;
112
113
  const hasFocusedCandidate = container.contains(previouslyFocusedElement);
113
114
  if (!hasFocusedCandidate) {
114
- const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
115
+ const mountEvent = new OwnerCustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
115
116
  container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
116
117
  container.dispatchEvent(mountEvent);
117
118
  if (!mountEvent.defaultPrevented) {
@@ -124,7 +125,7 @@ function FocusScope(props) {
124
125
  return () => {
125
126
  container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
126
127
  setTimeout(() => {
127
- const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
128
+ const unmountEvent = new OwnerCustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
128
129
  container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
129
130
  container.dispatchEvent(unmountEvent);
130
131
  if (!unmountEvent.defaultPrevented) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/radix",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -47,10 +47,10 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "aria-hidden": "^1.2.6",
50
- "@octanejs/floating-ui": "0.1.46"
50
+ "@octanejs/floating-ui": "0.1.48"
51
51
  },
52
52
  "peerDependencies": {
53
- "octane": "0.1.47"
53
+ "octane": "0.1.49"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@tsrx/react": "^0.2.61",
@@ -59,7 +59,7 @@
59
59
  "react": "^19.2.7",
60
60
  "react-dom": "^19.2.7",
61
61
  "vitest": "^4.1.10",
62
- "octane": "0.1.47"
62
+ "octane": "0.1.49"
63
63
  },
64
64
  "scripts": {
65
65
  "build:cjs": "node ../../scripts/build-package-commonjs.mjs",
package/src/FocusScope.ts CHANGED
@@ -103,10 +103,11 @@ export function FocusScope(props: any): any {
103
103
  () => {
104
104
  if (!container) return;
105
105
  focusScopesStack.add(focusScope);
106
+ const OwnerCustomEvent = container.ownerDocument.defaultView?.CustomEvent ?? CustomEvent;
106
107
  const previouslyFocusedElement = document.activeElement as HTMLElement | null;
107
108
  const hasFocusedCandidate = container.contains(previouslyFocusedElement);
108
109
  if (!hasFocusedCandidate) {
109
- const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
110
+ const mountEvent = new OwnerCustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
110
111
  container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
111
112
  container.dispatchEvent(mountEvent);
112
113
  if (!mountEvent.defaultPrevented) {
@@ -119,7 +120,7 @@ export function FocusScope(props: any): any {
119
120
  return () => {
120
121
  container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
121
122
  setTimeout(() => {
122
- const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
123
+ const unmountEvent = new OwnerCustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
123
124
  container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
124
125
  container.dispatchEvent(unmountEvent);
125
126
  if (!unmountEvent.defaultPrevented) {