@tai42/studio-sdk 22.0.1 → 22.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-focus.d.ts","sourceRoot":"","sources":["../../src/components/modal-focus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal-focus.d.ts","sourceRoot":"","sources":["../../src/components/modal-focus.ts"],"names":[],"mappings":"AAmDA,MAAM,WAAW,wBAAwB;IACvC,qFAAqF;IACrF,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjD,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACnD;AA8CD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,OAAO,GAAG,wBAAwB,CAqDjF"}
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
* that is itself removed first takes the listener with it. Removing it any
|
|
38
38
|
* earlier would strip the attribute out from under the focus it exists to hold.
|
|
39
39
|
*
|
|
40
|
+
* A modal opened while nothing held focus — `<body>` or the document element
|
|
41
|
+
* active, as when a page opens it from code — has no opener and no place in the
|
|
42
|
+
* page to return to. Nothing is recorded, and on close the handler only cancels
|
|
43
|
+
* Radix's default: focus stays wherever the close left it, including wherever
|
|
44
|
+
* the page itself moved it.
|
|
45
|
+
*
|
|
40
46
|
* When a Trigger IS rendered both handlers stand down and prevent nothing, so
|
|
41
47
|
* Radix's own restore runs untouched — there is never a second mechanism
|
|
42
48
|
* competing with the primitive.
|
|
@@ -98,9 +104,15 @@ export function useModalFocusReturn(hasTrigger) {
|
|
|
98
104
|
return;
|
|
99
105
|
// The focus scope dispatches this BEFORE it focuses the panel, so the
|
|
100
106
|
// active element is still whatever the reader activated to open the modal,
|
|
101
|
-
// and its ancestors are still attached to record.
|
|
107
|
+
// and its ancestors are still attached to record. `<body>` and the
|
|
108
|
+
// document element are where focus sits when nothing holds it, so they
|
|
109
|
+
// are no opener.
|
|
102
110
|
const active = document.activeElement;
|
|
103
|
-
const opener = active instanceof HTMLElement
|
|
111
|
+
const opener = active instanceof HTMLElement &&
|
|
112
|
+
active !== document.body &&
|
|
113
|
+
active !== document.documentElement
|
|
114
|
+
? active
|
|
115
|
+
: null;
|
|
104
116
|
openerRef.current = opener;
|
|
105
117
|
openedUnderRef.current = opener === null ? [] : ancestorChain(opener);
|
|
106
118
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-focus.js","sourceRoot":"","sources":["../../src/components/modal-focus.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"modal-focus.js","sourceRoot":"","sources":["../../src/components/modal-focus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAS/B;;;;GAIG;AACH,SAAS,aAAa,CAAC,OAAoB;IACzC,MAAM,KAAK,GAAkB,EAAE,CAAC;IAChC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IACvC,KACE,IAAI,IAAI,GAAG,OAAO,CAAC,aAAa,EAChC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAC9B,IAAI,GAAG,IAAI,CAAC,aAAa,EACzB,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,OAAoB;IAC3C,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACnD,IAAI,QAAQ;QAAE,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;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AAC,KAAY,EAAQ,EAAE;YACvC,IAAI,UAAU;gBAAE,OAAO;YACvB,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;YACjC,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC;YAC3C,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;YACzB,cAAc,CAAC,OAAO,GAAG,EAAE,CAAC;YAE5B,kEAAkE;YAClE,sEAAsE;YACtE,qEAAqE;YACrE,wEAAwE;YACxE,iDAAiD;YACjD,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,MAAM,KAAK,IAAI;gBAAE,OAAO;YAE5B,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,MAAM,CAAC,aAAa,CAAC,aAAa,KAAK,MAAM;gBAAE,OAAO;YAE1D,0EAA0E;YAC1E,0EAA0E;YAC1E,yEAAyE;YACzE,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;YACvE,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;gBAC7B,IAAI,QAAQ,CAAC,WAAW,IAAI,eAAe,CAAC,QAAQ,CAAC;oBAAE,OAAO;YAChE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tai42/studio-sdk",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.2",
|
|
4
4
|
"description": "The Studio plugin contract, shared UI components, and hooks that every feature builds on.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "tai42 <oss@tai42.ai>",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@radix-ui/react-select": "^2.3.8",
|
|
97
97
|
"@radix-ui/react-tabs": "^1.1.22",
|
|
98
98
|
"@radix-ui/react-tooltip": "^1.3.0",
|
|
99
|
-
"@tai42/api-client": "22.0.
|
|
99
|
+
"@tai42/api-client": "22.0.2"
|
|
100
100
|
},
|
|
101
101
|
"scripts": {
|
|
102
102
|
"build": "tsc -b tsconfig.build.json && node scripts/copy-assets.mjs",
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
* that is itself removed first takes the listener with it. Removing it any
|
|
38
38
|
* earlier would strip the attribute out from under the focus it exists to hold.
|
|
39
39
|
*
|
|
40
|
+
* A modal opened while nothing held focus — `<body>` or the document element
|
|
41
|
+
* active, as when a page opens it from code — has no opener and no place in the
|
|
42
|
+
* page to return to. Nothing is recorded, and on close the handler only cancels
|
|
43
|
+
* Radix's default: focus stays wherever the close left it, including wherever
|
|
44
|
+
* the page itself moved it.
|
|
45
|
+
*
|
|
40
46
|
* When a Trigger IS rendered both handlers stand down and prevent nothing, so
|
|
41
47
|
* Radix's own restore runs untouched — there is never a second mechanism
|
|
42
48
|
* competing with the primitive.
|
|
@@ -114,9 +120,16 @@ export function useModalFocusReturn(hasTrigger: boolean): ModalFocusReturnHandle
|
|
|
114
120
|
if (hasTrigger) return;
|
|
115
121
|
// The focus scope dispatches this BEFORE it focuses the panel, so the
|
|
116
122
|
// active element is still whatever the reader activated to open the modal,
|
|
117
|
-
// and its ancestors are still attached to record.
|
|
123
|
+
// and its ancestors are still attached to record. `<body>` and the
|
|
124
|
+
// document element are where focus sits when nothing holds it, so they
|
|
125
|
+
// are no opener.
|
|
118
126
|
const active = document.activeElement;
|
|
119
|
-
const opener =
|
|
127
|
+
const opener =
|
|
128
|
+
active instanceof HTMLElement &&
|
|
129
|
+
active !== document.body &&
|
|
130
|
+
active !== document.documentElement
|
|
131
|
+
? active
|
|
132
|
+
: null;
|
|
120
133
|
openerRef.current = opener;
|
|
121
134
|
openedUnderRef.current = opener === null ? [] : ancestorChain(opener);
|
|
122
135
|
},
|