@primer/behaviors 1.5.1 → 1.6.0-rc.192d841

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.
@@ -259,6 +259,11 @@ function focusZone(container, settings) {
259
259
  endFocusManagement(...(0, iterate_focusable_elements_js_1.iterateFocusableElements)(removedNode, iterateFocusableElementsOptions));
260
260
  }
261
261
  }
262
+ if (mutation.type === 'attributes' && mutation.oldValue === null) {
263
+ if (mutation.target instanceof HTMLElement) {
264
+ endFocusManagement(mutation.target);
265
+ }
266
+ }
262
267
  }
263
268
  for (const mutation of mutations) {
264
269
  for (const addedNode of mutation.addedNodes) {
@@ -266,11 +271,18 @@ function focusZone(container, settings) {
266
271
  beginFocusManagement(...(0, iterate_focusable_elements_js_1.iterateFocusableElements)(addedNode, iterateFocusableElementsOptions));
267
272
  }
268
273
  }
274
+ if (mutation.type === 'attributes' && mutation.oldValue !== null) {
275
+ if (mutation.target instanceof HTMLElement) {
276
+ beginFocusManagement(mutation.target);
277
+ }
278
+ }
269
279
  }
270
280
  });
271
281
  observer.observe(container, {
272
282
  subtree: true,
273
283
  childList: true,
284
+ attributeFilter: ['hidden', 'disabled'],
285
+ attributeOldValue: true,
274
286
  });
275
287
  const controller = new AbortController();
276
288
  const signal = (_e = settings === null || settings === void 0 ? void 0 : settings.abortSignal) !== null && _e !== void 0 ? _e : controller.signal;
@@ -256,6 +256,11 @@ export function focusZone(container, settings) {
256
256
  endFocusManagement(...iterateFocusableElements(removedNode, iterateFocusableElementsOptions));
257
257
  }
258
258
  }
259
+ if (mutation.type === 'attributes' && mutation.oldValue === null) {
260
+ if (mutation.target instanceof HTMLElement) {
261
+ endFocusManagement(mutation.target);
262
+ }
263
+ }
259
264
  }
260
265
  for (const mutation of mutations) {
261
266
  for (const addedNode of mutation.addedNodes) {
@@ -263,11 +268,18 @@ export function focusZone(container, settings) {
263
268
  beginFocusManagement(...iterateFocusableElements(addedNode, iterateFocusableElementsOptions));
264
269
  }
265
270
  }
271
+ if (mutation.type === 'attributes' && mutation.oldValue !== null) {
272
+ if (mutation.target instanceof HTMLElement) {
273
+ beginFocusManagement(mutation.target);
274
+ }
275
+ }
266
276
  }
267
277
  });
268
278
  observer.observe(container, {
269
279
  subtree: true,
270
280
  childList: true,
281
+ attributeFilter: ['hidden', 'disabled'],
282
+ attributeOldValue: true,
271
283
  });
272
284
  const controller = new AbortController();
273
285
  const signal = (_e = settings === null || settings === void 0 ? void 0 : settings.abortSignal) !== null && _e !== void 0 ? _e : controller.signal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/behaviors",
3
- "version": "1.5.1",
3
+ "version": "1.6.0-rc.192d841",
4
4
  "description": "Shared behaviors for JavaScript components",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -66,21 +66,22 @@
66
66
  }
67
67
  ],
68
68
  "devDependencies": {
69
- "@changesets/changelog-github": "^0.4.2",
69
+ "@changesets/changelog-github": "^0.5.0",
70
70
  "@changesets/cli": "^2.18.1",
71
71
  "@github/prettier-config": "^0.0.6",
72
72
  "@size-limit/preset-small-lib": "^8.2.4",
73
- "@testing-library/react": "^14.0.0",
73
+ "@testing-library/react": "^15.0.2",
74
74
  "@testing-library/user-event": "^14.5.1",
75
- "@types/jest": "^27.0.3",
76
- "@types/node": "^18.18.0",
75
+ "@types/jest": "^29.5.11",
76
+ "@types/node": "^20.10.5",
77
77
  "@types/react": "^18.2.23",
78
- "esbuild": "^0.19.4",
78
+ "esbuild": "^0.21.1",
79
79
  "esbuild-jest": "^0.5.0",
80
80
  "eslint": "^8.50.0",
81
81
  "eslint-plugin-github": "^4.10.0",
82
82
  "eslint-plugin-prettier": "^5.0.0",
83
- "jest": "^27.4.3",
83
+ "jest": "^29.7.0",
84
+ "jest-environment-jsdom": "^29.7.0",
84
85
  "prettier": "^3.0.3",
85
86
  "react": "^18.2.0",
86
87
  "react-dom": "^18.2.0",