@zag-js/focus-visible 1.12.2 → 1.12.4

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 CHANGED
@@ -70,12 +70,16 @@ function setupGlobalFocusEvents(root) {
70
70
  const win = domQuery.getWindow(root);
71
71
  const doc = domQuery.getDocument(root);
72
72
  let focus = win.HTMLElement.prototype.focus;
73
- win.HTMLElement.prototype.focus = function() {
73
+ function patchedFocus() {
74
74
  currentModality = "virtual";
75
75
  triggerChangeHandlers("virtual", null);
76
76
  hasEventBeforeFocus = true;
77
77
  focus.apply(this, arguments);
78
- };
78
+ }
79
+ Object.defineProperty(win.HTMLElement.prototype, "focus", {
80
+ configurable: true,
81
+ value: patchedFocus
82
+ });
79
83
  doc.addEventListener("keydown", handleKeyboardEvent, true);
80
84
  doc.addEventListener("keyup", handleKeyboardEvent, true);
81
85
  doc.addEventListener("click", handleClickEvent, true);
package/dist/index.mjs CHANGED
@@ -68,12 +68,16 @@ function setupGlobalFocusEvents(root) {
68
68
  const win = getWindow(root);
69
69
  const doc = getDocument(root);
70
70
  let focus = win.HTMLElement.prototype.focus;
71
- win.HTMLElement.prototype.focus = function() {
71
+ function patchedFocus() {
72
72
  currentModality = "virtual";
73
73
  triggerChangeHandlers("virtual", null);
74
74
  hasEventBeforeFocus = true;
75
75
  focus.apply(this, arguments);
76
- };
76
+ }
77
+ Object.defineProperty(win.HTMLElement.prototype, "focus", {
78
+ configurable: true,
79
+ value: patchedFocus
80
+ });
77
81
  doc.addEventListener("keydown", handleKeyboardEvent, true);
78
82
  doc.addEventListener("keyup", handleKeyboardEvent, true);
79
83
  doc.addEventListener("click", handleClickEvent, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/focus-visible",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
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.12.2"
28
+ "@zag-js/dom-query": "1.12.4"
29
29
  },
30
30
  "devDependencies": {
31
31
  "clean-package": "2.2.0"