@zag-js/focus-visible 2.0.0-next.2 → 2.0.0-next.3
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/index.js +6 -1
- package/dist/index.mjs +16 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -111,7 +111,12 @@ function handleClickEvent(e) {
|
|
|
111
111
|
function handleFocusEvent(e) {
|
|
112
112
|
const target = (0, import_dom_query.getEventTarget)(e);
|
|
113
113
|
const isLabelActivationFocus = target === pendingLabelControl;
|
|
114
|
-
if (
|
|
114
|
+
if (ignoreFocusEvent) return;
|
|
115
|
+
if ((0, import_dom_query.isWindow)(target)) {
|
|
116
|
+
hasBlurredWindowRecently = true;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if ((0, import_dom_query.isDocument)(target) || !e.isTrusted) {
|
|
115
120
|
return;
|
|
116
121
|
}
|
|
117
122
|
if (!hasEventBeforeFocus && !isLabelActivationFocus && !hasBlurredWindowRecently) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getActiveElement,
|
|
4
|
+
getDocument,
|
|
5
|
+
getEventTarget,
|
|
6
|
+
getWindow,
|
|
7
|
+
isDocument,
|
|
8
|
+
isMac,
|
|
9
|
+
isVirtualClick,
|
|
10
|
+
isWindow
|
|
11
|
+
} from "@zag-js/dom-query";
|
|
3
12
|
function isValidKey(e) {
|
|
4
13
|
return !(e.metaKey || !isMac() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
5
14
|
}
|
|
@@ -81,7 +90,12 @@ function handleClickEvent(e) {
|
|
|
81
90
|
function handleFocusEvent(e) {
|
|
82
91
|
const target = getEventTarget(e);
|
|
83
92
|
const isLabelActivationFocus = target === pendingLabelControl;
|
|
84
|
-
if (
|
|
93
|
+
if (ignoreFocusEvent) return;
|
|
94
|
+
if (isWindow(target)) {
|
|
95
|
+
hasBlurredWindowRecently = true;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (isDocument(target) || !e.isTrusted) {
|
|
85
99
|
return;
|
|
86
100
|
}
|
|
87
101
|
if (!hasEventBeforeFocus && !isLabelActivationFocus && !hasBlurredWindowRecently) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/focus-visible",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.3",
|
|
4
4
|
"description": "Focus visible polyfill utility based on WICG",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean-package": "../../../clean-package.config.json",
|
|
29
29
|
"main": "dist/index.js",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@zag-js/dom-query": "2.0.0-next.
|
|
31
|
+
"@zag-js/dom-query": "2.0.0-next.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"clean-package": "2.2.0"
|