@workday/canvas-kit-react 7.4.7 → 7.4.8
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/dist/commonjs/popup/lib/hooks/useReturnFocus.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/useReturnFocus.js +13 -2
- package/dist/es6/popup/lib/hooks/useReturnFocus.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/useReturnFocus.js +13 -2
- package/package.json +3 -3
- package/popup/lib/hooks/useReturnFocus.tsx +15 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReturnFocus.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useReturnFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiC1B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useReturnFocus.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useReturnFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiC1B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;OA6GzB,CAAC"}
|
|
@@ -104,7 +104,11 @@ exports.useReturnFocus = common_1.createElemPropsHook(usePopupModel_1.usePopupMo
|
|
|
104
104
|
elementRef.current = null;
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
var activeElementOutsidePopupStack = document.activeElement !== document.body &&
|
|
108
|
+
model.state.stackRef.current &&
|
|
109
|
+
document.activeElement instanceof HTMLElement &&
|
|
110
|
+
!canvas_kit_popup_stack_1.PopupStack.contains(model.state.stackRef.current, document.activeElement);
|
|
111
|
+
if (activeElementOutsidePopupStack || requiresFocusChangeRef.current) {
|
|
108
112
|
// We need to change focus _before_ the browser process the default action of picking a new
|
|
109
113
|
// focus target. Doing this immediately prevents the `focus` event from firing on `element`,
|
|
110
114
|
// but that's okay because the browser will change focus anyways.
|
|
@@ -119,6 +123,13 @@ exports.useReturnFocus = common_1.createElemPropsHook(usePopupModel_1.usePopupMo
|
|
|
119
123
|
}
|
|
120
124
|
elementRef.current = null;
|
|
121
125
|
};
|
|
122
|
-
}, [
|
|
126
|
+
}, [
|
|
127
|
+
model.state.returnFocusRef,
|
|
128
|
+
model.state.targetRef,
|
|
129
|
+
visible,
|
|
130
|
+
onMouseDown,
|
|
131
|
+
onKeyDown,
|
|
132
|
+
model.state.stackRef,
|
|
133
|
+
]);
|
|
123
134
|
return {};
|
|
124
135
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReturnFocus.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useReturnFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiC1B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useReturnFocus.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useReturnFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiC1B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;OA6GzB,CAAC"}
|
|
@@ -98,7 +98,11 @@ export var useReturnFocus = createElemPropsHook(usePopupModel)(function (model)
|
|
|
98
98
|
elementRef.current = null;
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
var activeElementOutsidePopupStack = document.activeElement !== document.body &&
|
|
102
|
+
model.state.stackRef.current &&
|
|
103
|
+
document.activeElement instanceof HTMLElement &&
|
|
104
|
+
!PopupStack.contains(model.state.stackRef.current, document.activeElement);
|
|
105
|
+
if (activeElementOutsidePopupStack || requiresFocusChangeRef.current) {
|
|
102
106
|
// We need to change focus _before_ the browser process the default action of picking a new
|
|
103
107
|
// focus target. Doing this immediately prevents the `focus` event from firing on `element`,
|
|
104
108
|
// but that's okay because the browser will change focus anyways.
|
|
@@ -113,6 +117,13 @@ export var useReturnFocus = createElemPropsHook(usePopupModel)(function (model)
|
|
|
113
117
|
}
|
|
114
118
|
elementRef.current = null;
|
|
115
119
|
};
|
|
116
|
-
}, [
|
|
120
|
+
}, [
|
|
121
|
+
model.state.returnFocusRef,
|
|
122
|
+
model.state.targetRef,
|
|
123
|
+
visible,
|
|
124
|
+
onMouseDown,
|
|
125
|
+
onKeyDown,
|
|
126
|
+
model.state.stackRef,
|
|
127
|
+
]);
|
|
117
128
|
return {};
|
|
118
129
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.8",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
50
|
"@popperjs/core": "^2.5.4",
|
|
51
51
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
52
|
-
"@workday/canvas-kit-popup-stack": "^7.4.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^7.4.8",
|
|
53
53
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
54
54
|
"@workday/design-assets-types": "^0.2.8",
|
|
55
55
|
"chroma-js": "^2.1.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
69
69
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "95105328bd2875c3018f04831cbddfabe7f76038"
|
|
72
72
|
}
|
|
@@ -116,7 +116,13 @@ export const useReturnFocus = createElemPropsHook(usePopupModel)(model => {
|
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
const activeElementOutsidePopupStack =
|
|
120
|
+
document.activeElement !== document.body &&
|
|
121
|
+
model.state.stackRef.current &&
|
|
122
|
+
document.activeElement instanceof HTMLElement &&
|
|
123
|
+
!PopupStack.contains(model.state.stackRef.current, document.activeElement);
|
|
124
|
+
|
|
125
|
+
if (activeElementOutsidePopupStack || requiresFocusChangeRef.current) {
|
|
120
126
|
// We need to change focus _before_ the browser process the default action of picking a new
|
|
121
127
|
// focus target. Doing this immediately prevents the `focus` event from firing on `element`,
|
|
122
128
|
// but that's okay because the browser will change focus anyways.
|
|
@@ -131,7 +137,14 @@ export const useReturnFocus = createElemPropsHook(usePopupModel)(model => {
|
|
|
131
137
|
|
|
132
138
|
elementRef.current = null;
|
|
133
139
|
};
|
|
134
|
-
}, [
|
|
140
|
+
}, [
|
|
141
|
+
model.state.returnFocusRef,
|
|
142
|
+
model.state.targetRef,
|
|
143
|
+
visible,
|
|
144
|
+
onMouseDown,
|
|
145
|
+
onKeyDown,
|
|
146
|
+
model.state.stackRef,
|
|
147
|
+
]);
|
|
135
148
|
|
|
136
149
|
return {};
|
|
137
150
|
});
|