@zag-js/focus-visible 1.25.0 → 1.26.1
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 +16 -6
- package/dist/index.mjs +16 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -76,10 +76,13 @@ function setupGlobalFocusEvents(root) {
|
|
|
76
76
|
hasEventBeforeFocus = true;
|
|
77
77
|
focus.apply(this, arguments);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
try {
|
|
80
|
+
Object.defineProperty(win.HTMLElement.prototype, "focus", {
|
|
81
|
+
configurable: true,
|
|
82
|
+
value: patchedFocus
|
|
83
|
+
});
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
83
86
|
doc.addEventListener("keydown", handleKeyboardEvent, true);
|
|
84
87
|
doc.addEventListener("keyup", handleKeyboardEvent, true);
|
|
85
88
|
doc.addEventListener("click", handleClickEvent, true);
|
|
@@ -106,10 +109,17 @@ function setupGlobalFocusEvents(root) {
|
|
|
106
109
|
var tearDownWindowFocusTracking = (root, loadListener) => {
|
|
107
110
|
const win = domQuery.getWindow(root);
|
|
108
111
|
const doc = domQuery.getDocument(root);
|
|
109
|
-
|
|
112
|
+
const listenerData = listenerMap.get(win);
|
|
113
|
+
if (!listenerData) {
|
|
110
114
|
return;
|
|
111
115
|
}
|
|
112
|
-
|
|
116
|
+
try {
|
|
117
|
+
Object.defineProperty(win.HTMLElement.prototype, "focus", {
|
|
118
|
+
configurable: true,
|
|
119
|
+
value: listenerData.focus
|
|
120
|
+
});
|
|
121
|
+
} catch {
|
|
122
|
+
}
|
|
113
123
|
doc.removeEventListener("keydown", handleKeyboardEvent, true);
|
|
114
124
|
doc.removeEventListener("keyup", handleKeyboardEvent, true);
|
|
115
125
|
doc.removeEventListener("click", handleClickEvent, true);
|
package/dist/index.mjs
CHANGED
|
@@ -74,10 +74,13 @@ function setupGlobalFocusEvents(root) {
|
|
|
74
74
|
hasEventBeforeFocus = true;
|
|
75
75
|
focus.apply(this, arguments);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
try {
|
|
78
|
+
Object.defineProperty(win.HTMLElement.prototype, "focus", {
|
|
79
|
+
configurable: true,
|
|
80
|
+
value: patchedFocus
|
|
81
|
+
});
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
81
84
|
doc.addEventListener("keydown", handleKeyboardEvent, true);
|
|
82
85
|
doc.addEventListener("keyup", handleKeyboardEvent, true);
|
|
83
86
|
doc.addEventListener("click", handleClickEvent, true);
|
|
@@ -104,10 +107,17 @@ function setupGlobalFocusEvents(root) {
|
|
|
104
107
|
var tearDownWindowFocusTracking = (root, loadListener) => {
|
|
105
108
|
const win = getWindow(root);
|
|
106
109
|
const doc = getDocument(root);
|
|
107
|
-
|
|
110
|
+
const listenerData = listenerMap.get(win);
|
|
111
|
+
if (!listenerData) {
|
|
108
112
|
return;
|
|
109
113
|
}
|
|
110
|
-
|
|
114
|
+
try {
|
|
115
|
+
Object.defineProperty(win.HTMLElement.prototype, "focus", {
|
|
116
|
+
configurable: true,
|
|
117
|
+
value: listenerData.focus
|
|
118
|
+
});
|
|
119
|
+
} catch {
|
|
120
|
+
}
|
|
111
121
|
doc.removeEventListener("keydown", handleKeyboardEvent, true);
|
|
112
122
|
doc.removeEventListener("keyup", handleKeyboardEvent, true);
|
|
113
123
|
doc.removeEventListener("click", handleClickEvent, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/focus-visible",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.1",
|
|
4
4
|
"description": "Focus visible polyfill utility based on WICG",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"clean-package": "../../../clean-package.config.json",
|
|
26
26
|
"main": "dist/index.js",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@zag-js/dom-query": "1.
|
|
28
|
+
"@zag-js/dom-query": "1.26.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"clean-package": "2.2.0"
|