@testing-library/user-event 14.0.0-beta.12 → 14.0.0-beta.13

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.cjs CHANGED
@@ -643,7 +643,30 @@ function eventWrapper(cb) {
643
643
 
644
644
  // src/utils/misc/isDisabled.ts
645
645
  function isDisabled(element) {
646
- return Boolean(element && element.disabled);
646
+ var _a;
647
+ for (let el = element; el; el = el.parentElement) {
648
+ if (isElementType(el, [
649
+ "button",
650
+ "input",
651
+ "select",
652
+ "textarea",
653
+ "optgroup",
654
+ "option"
655
+ ])) {
656
+ if (el.hasAttribute("disabled")) {
657
+ return true;
658
+ }
659
+ } else if (isElementType(el, "fieldset")) {
660
+ if (el.hasAttribute("disabled") && !((_a = el.querySelector(":scope > legend")) == null ? void 0 : _a.contains(element))) {
661
+ return true;
662
+ }
663
+ } else if (el.tagName.includes("-")) {
664
+ if (el.constructor.formAssociated && el.hasAttribute("disabled")) {
665
+ return true;
666
+ }
667
+ }
668
+ }
669
+ return false;
647
670
  }
648
671
 
649
672
  // src/utils/focus/getActiveElement.ts
package/dist/index.mjs CHANGED
@@ -655,7 +655,30 @@ function eventWrapper(cb) {
655
655
 
656
656
  // src/utils/misc/isDisabled.ts
657
657
  function isDisabled(element) {
658
- return Boolean(element && element.disabled);
658
+ var _a;
659
+ for (let el = element; el; el = el.parentElement) {
660
+ if (isElementType(el, [
661
+ "button",
662
+ "input",
663
+ "select",
664
+ "textarea",
665
+ "optgroup",
666
+ "option"
667
+ ])) {
668
+ if (el.hasAttribute("disabled")) {
669
+ return true;
670
+ }
671
+ } else if (isElementType(el, "fieldset")) {
672
+ if (el.hasAttribute("disabled") && !((_a = el.querySelector(":scope > legend")) == null ? void 0 : _a.contains(element))) {
673
+ return true;
674
+ }
675
+ } else if (el.tagName.includes("-")) {
676
+ if (el.constructor.formAssociated && el.hasAttribute("disabled")) {
677
+ return true;
678
+ }
679
+ }
680
+ }
681
+ return false;
659
682
  }
660
683
 
661
684
  // src/utils/focus/getActiveElement.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/user-event",
3
- "version": "14.0.0-beta.12",
3
+ "version": "14.0.0-beta.13",
4
4
  "description": "Fire events the same way the user does",
5
5
  "keywords": [
6
6
  "react-testing-library",