{
  "version": "1.0",
  "constraints": {
    "$atomic": {
      "xpath": "not(boolean((.//*[@role and @role != 'none' and @role != 'presentation'] | .//a | .//area | .//button | .//input | .//object | .//select | .//textarea)[not(ancestor-or-self::*/@aria-hidden = 'true')]))",
      "description": "Element cannot contain other accessible elements"
    },
    "$hasTitleOrText": {
      "xpath": "boolean(@title and @title != '') or boolean(.//text()[normalize-space(.) != ''])",
      "description": "Element must contain text nodes or title attribute"
    },
    "$existingIDs": {
      "js": "checkIdentifiers",
      "description": "Value must be space-separated list of existing element identifiers"
    },
    "$hasIdentifiedLabel": {
      "xpath": ".//label[@id and boolean(normalize-space(.//text()) != '')] | .//button | .//*[@role='checkbox']",
      "description": "Label should always have id and some text content"
    },
    "$hasIdentifiedInput": {
      "xpath": ".//input[@aria-labelledby|@id] | .//button | .//*[@role='checkbox']",
      "description": "Should have input containing either id or aria-labelledby"
    },
    "$hasIdentifiedMessage": {
      "xpath": "boolean(.//*[@aria-invalid] and .//*[@role='alert' and @id] and .//*[@aria-labelledby]) or not(.//*[@aria-invalid])",
      "description": "Message should have identifier, role='alert' and combined with a `aria-invalid` and `aria-labelledby` input"
    },
    "$isValidRadioGroup": {
      "xpath": "boolean(.//*[@role='radiogroup' and @aria-labelledby|@aria-label])",
      "description": "RadioGroup inside form should have aria-labelledby attribute"
    }
  },
  "parameters": {
    "$title": {
      "name": "title",
      "attributes": [
        {
          "name": "title",
          "constraints": [
            {
              "xpath": "normalize-space(@title) != ''",
              "description": "title attribute value cannot be empty"
            },
            {
              "js": "equalsToAccessibilityLabelIfAny",
              "description": "In order to not confuse the users, the title attribute value should be equal to the accessibility label value"
            }
          ]
        }
      ]
    },
    "$label": {
      "one": [
        {
          "name": "label",
          "attributes": [
            {
              "name": "aria-label",
              "constraints": [
                {
                  "xpath": "normalize-space(@aria-label) != ''",
                  "description": "aria-label attribute value cannot be empty"
                }
              ]
            }
          ]
        },
        {
          "name": "labelledBy",
          "attributes": [
            {
              "name": "aria-labelledby",
              "constraints": [
                {
                  "ref": "$existingIDs"
                }
              ]
            }
          ]
        }
      ]
    },
    "$setsize": {
      "name": "setsize",
      "attributes": [
        {
          "name": "aria-setsize",
          "constraints": [
            {
              "xpath": "number(@aria-setsize) = @aria-setsize",
              "description": "aria-setsize attribute value should be a number"
            }
          ]
        }
      ]
    },
    "$posinset": {
      "name": "posinset",
      "attributes": [
        {
          "name": "aria-posinset",
          "constraints": [
            {
              "xpath": "number(@aria-posinset) = @aria-posinset",
              "description": "aria-posinset attribute value should be a number"
            }
          ]
        }
      ]
    },
    "$level": {
      "name": "level",
      "attributes": [
        {
          "name": "aria-level",
          "constraints": [
            {
              "xpath": "number(@aria-level) = @aria-level",
              "description": "aria-level attribute value should be a number"
            }
          ]
        }
      ]
    },
    "$describedBy": {
      "name": "describedBy",
      "attributes": [
        {
          "name": "aria-describedby",
          "constraints": [
            {
              "ref": "$existingIDs"
            }
          ]
        }
      ]
    },
    "$disabled": {
      "name": "disabled",
      "attributes": [
        {
          "name": "disabled",
          "value": [
            {
              "parameter": true,
              "attribute": true
            },
            {
              "parameter": false,
              "attribute": false
            }
          ]
        },
        {
          "name": "aria-disabled",
          "value": [
            {
              "parameter": true,
              "attribute": "true"
            },
            {
              "parameter": false,
              "attribute": "false"
            }
          ],
          "optional": true
        }
      ]
    },
    "$disabled-custom": {
      "name": "disabled",
      "attributes": [
        {
          "name": "aria-disabled",
          "value": [
            {
              "parameter": true,
              "attribute": "true"
            },
            {
              "parameter": false,
              "attribute": [false, "false"]
            }
          ]
        },
        {
          "name": "disabled",
          "value": [
            {
              "parameter": true,
              "attribute": true
            },
            {
              "parameter": false,
              "attribute": false
            }
          ],
          "optional": true
        }
      ]
    },
    "$tabbable": {
      "name": "tabbable",
      "attributes": [
        {
          "name": "tabindex",
          "value": [
            {
              "parameter": true,
              "attribute": "0"
            },
            {
              "parameter": false,
              "attribute": "-1"
            }
          ]
        }
      ]
    },
    "$hasPopup": {
      "name": "hasPopup",
      "attributes": [
        {
          "name": "aria-haspopup",
          "value": [
            {
              "parameter": true,
              "attribute": ["true", "menu"]
            },
            {
              "parameter": false,
              "attribute": [false, "false"]
            }
          ]
        }
      ]
    },
    "$isExpanded": {
      "name": "isExpanded",
      "attributes": [
        {
          "name": "aria-expanded",
          "value": [
            {
              "parameter": true,
              "attribute": "true"
            },
            {
              "parameter": false,
              "attribute": [false, "false"]
            }
          ]
        }
      ]
    },
    "$isSelected": {
      "name": "isSelected",
      "attributes": [
        {
          "name": "aria-selected",
          "value": [
            {
              "parameter": true,
              "attribute": "true"
            },
            {
              "parameter": true,
              "attribute": "false"
            }
          ]
        }
      ]
    },
    "$isPressed": {
      "name": "isPressed",
      "attributes": [
        {
          "name": "aria-pressed",
          "value": [
            {
              "parameter": true,
              "attribute": "true"
            },
            {
              "parameter": false,
              "attribute": [false, "false"]
            }
          ]
        }
      ]
    },
    "$checked": {
      "name": "checked",
      "attributes": [
        {
          "name": "checked",
          "value": [
            {
              "parameter": true,
              "attribute": true
            },
            {
              "parameter": false,
              "attribute": false
            }
          ]
        },
        {
          "name": "aria-checked",
          "value": [
            {
              "parameter": true,
              "attribute": "true"
            },
            {
              "parameter": false,
              "attribute": [false, "false"]
            }
          ],
          "optional": true
        }
      ]
    },
    "$checked-custom": {
      "name": "checked",
      "attributes": [
        {
          "name": "aria-checked",
          "value": [
            {
              "parameter": true,
              "attribute": "true"
            },
            {
              "parameter": false,
              "attribute": [false, "false"]
            }
          ]
        },
        {
          "name": "checked",
          "value": [
            {
              "parameter": true,
              "attribute": true
            },
            {
              "parameter": false,
              "attribute": false
            }
          ],
          "optional": true
        }
      ]
    }
  },
  "attributes": {
    "$tabindex": {
      "name": "tabindex",
      "value": ["0", "-1"]
    }
  },
  "classes": {
    "Body": {
      "assumptions": [
        {
          "tag": "<body>"
        }
      ],
      "tags": {
        "<body>": {}
      }
    },
    "Header1": {
      "assumptions": [
        {
          "tag": "<h1>"
        },
        {
          "tag": "<div>",
          "attributes": [
            {
              "name": "role",
              "value": "heading"
            },
            {
              "name": "aria-level",
              "value": "1"
            }
          ]
        }
      ],
      "parameters": [
        {
          "ref": "$label",
          "optional": {
            "ref": "$hasTitleOrText"
          }
        }
      ],
      "tags": {
        "<h1>": {},
        "<div>": {
          "attributes": [
            {
              "name": "role",
              "value": "heading"
            },
            {
              "name": "aria-level",
              "value": "1"
            }
          ]
        }
      }
    },
    "TreeItem": {
      "constraints": [
        {
          "ref": "$atomic"
        }
      ],
      "parameters": [
        {
          "ref": "$title",
          "optional": true
        },
        {
          "rel": "@tabbable"
        },
        {
          "ref": "$isExpanded"
        },
        {
          "ref": "$isSelected",
          "optional": true
        },
        {
          "ref": "$setsize"
        },
        {
          "ref": "$posinset"
        },
        {
          "ref": "$level"
        }
      ],
      "tags": {
        "<div>, <span>, <a>": {
          "parameters": {
            "@tabbable": {
              "ref": "$tabbable",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "role",
              "value": "treeitem",
              "overridable": "role"
            },
            {
              "ref": "$tabindex"
            }
          ]
        }
      }
    },
    "TreeTitle": {
      "constraints": [
        {
          "ref": "$atomic"
        }
      ],
      "parameters": [
        {
          "ref": "$title",
          "optional": true
        },
        {
          "rel": "@tabbable"
        },
        {
          "ref": "$isSelected",
          "optional": true
        },
        {
          "ref": "$setsize"
        },
        {
          "ref": "$posinset"
        },
        {
          "ref": "$level"
        }
      ],
      "tags": {
        "<div>, <span>, <a>": {
          "parameters": {
            "@tabbable": {
              "ref": "$tabbable",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "role",
              "value": "treeitem",
              "overridable": "role"
            },
            {
              "ref": "$tabindex"
            }
          ]
        }
      }
    },
    "Button": {
      "assumptions": [
        {
          "tag": "<button>"
        },
        {
          "tag": "<div>",
          "attributes": [
            {
              "name": "role",
              "value": "button"
            }
          ]
        }
      ],
      "constraints": [
        {
          "ref": "$atomic"
        }
      ],
      "parameters": [
        {
          "ref": "$title",
          "optional": true
        },
        {
          "rel": "@label"
        },
        {
          "ref": "$describedBy",
          "optional": true
        },
        {
          "rel": "@tabbable"
        },
        {
          "rel": "@disabled",
          "overridable": "disabled"
        },
        {
          "ref": "$hasPopup",
          "optional": true,
          "overridable": "hasPopup"
        },
        {
          "ref": "$isExpanded",
          "optional": true
        },
        {
          "ref": "$isPressed",
          "optional": true
        }
      ],
      "tags": {
        "<button>": {
          "parameters": {
            "@label": {
              "ref": "$label",
              "optional": {
                "ref": "$hasTitleOrText"
              }
            },
            "@tabbable": {
              "ref": "$tabbable",
              "optional": true
            },
            "@disabled": {
              "ref": "$disabled",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "role",
              "value": "button",
              "optional": true,
              "overridable": "role"
            }
          ]
        },
        "<input>": {
          "parameters": {
            "@label": {
              "ref": "$label",
              "optional": {
                "xpath": "normalize-space(@value) != ''",
                "description": "Element must contain value attribute"
              }
            },
            "@tabbable": {
              "ref": "$tabbable",
              "optional": true
            },
            "@disabled": {
              "ref": "$disabled",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "type",
              "value": ["button", "submit", "reset"],
              "overridable": "type"
            },
            {
              "name": "role",
              "value": "button",
              "optional": true,
              "overridable": "role"
            }
          ]
        },
        "<div>, <span>": {
          "parameters": {
            "@label": {
              "ref": "$label",
              "optional": {
                "ref": "$hasTitleOrText"
              }
            },
            "@tabbable": {
              "ref": "$tabbable",
              "optional": true
            },
            "@disabled": {
              "ref": "$disabled-custom",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "role",
              "value": "button",
              "overridable": "role"
            },
            {
              "ref": "$tabindex"
            }
          ]
        }
      }
    },
    "LoadingButton": {
      "inherits": "Button",
      "parameters": [
        {
          "overrides": "disabled",
          "rel": "@disabled"
        }
      ],
      "tags": {
        "<button>": {
          "parameters": {
            "@disabled": {
              "optional": true,
              "name": "disabled",
              "attributes": [
                {
                  "name": "aria-disabled",
                  "value": [
                    {
                      "parameter": true,
                      "attribute": "true"
                    },
                    {
                      "parameter": false,
                      "attribute": [false, "false"]
                    }
                  ]
                }
              ]
            }
          }
        }
      }
    },
    "PopupButton": {
      "inherits": "Button",
      "parameters": [
        {
          "overrides": "hasPopup",
          "ref": null
        }
      ],
      "tags": {
        "<button>": {
          "attributes": [
            {
              "name": "aria-haspopup",
              "value": "true"
            }
          ]
        },
        "<input>": {
          "attributes": [
            {
              "name": "aria-haspopup",
              "value": "true"
            }
          ]
        },
        "<div>, <span>": {
          "attributes": [
            {
              "name": "aria-haspopup",
              "value": "true"
            }
          ]
        }
      }
    },
    "ToolbarItem": {
      "inherits": "Button"
    },
    "Checkbox": {
      "inherits": "Button",
      "parameters": [
        {
          "rel": "@checked"
        }
      ],
      "tags": {
        "<button>": {
          "parameters": {
            "@checked": {
              "ref": "$checked",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "role",
              "value": "checkbox",
              "overrides": "role",
              "overridable": "role"
            }
          ]
        },
        "<input>": {
          "parameters": {
            "@checked": {
              "ref": "$checked",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "type",
              "value": "checkbox",
              "overrides": "type",
              "overridable": "type"
            },
            {
              "name": "role",
              "value": "checkbox",
              "optional": true,
              "overrides": "role",
              "overridable": "role"
            }
          ]
        },
        "<div>, <span>": {
          "parameters": {
            "@checked": {
              "ref": "$checked-custom",
              "optional": true
            }
          },
          "attributes": [
            {
              "name": "role",
              "value": "checkbox",
              "overrides": "role",
              "overridable": "role"
            }
          ]
        }
      }
    },
    "RadioGroupItem": {
      "inherits": "Checkbox",
      "tags": {
        "<button>": {
          "attributes": [
            {
              "name": "role",
              "value": "radio",
              "overrides": "role"
            }
          ]
        },
        "<input>": {
          "attributes": [
            {
              "name": "type",
              "value": "radio",
              "overrides": "type"
            },
            {
              "name": "role",
              "value": "radio",
              "optional": true,
              "overrides": "role"
            }
          ]
        },
        "<div>, <span>": {
          "attributes": [
            {
              "name": "role",
              "value": "radio",
              "overrides": "role"
            }
          ]
        }
      }
    },
    "FormField": {
      "constraints": [
        {
          "ref": "$hasIdentifiedLabel"
        },
        {
          "ref": "$hasIdentifiedInput"
        },
        {
          "ref": "$hasIdentifiedMessage"
        }
      ],
      "tags": {
        "<div>, <span>": {}
      }
    },
    "FormInput": {
      "inherits": "FormField"
    },
    "FormRadioGroup": {
      "constraints": [
        {
          "ref": "$isValidRadioGroup"
        },
        {
          "ref": "$hasIdentifiedLabel"
        },
        {
          "ref": "$hasIdentifiedMessage"
        }
      ],
      "tags": {
        "<div>": {}
      }
    },
    "FormDropdown": {
      "inherits": "FormField"
    },
    "FormMessage": {
      "constraints": [
        {
          "ref": "$hasTitleOrText"
        },
        {
          "ref": "$atomic"
        }
      ],
      "tags": {
        "<span>, <div>": {}
      }
    },
    "FormLabel": {
      "constraints": [
        {
          "ref": "$hasTitleOrText"
        },
        {
          "ref": "$atomic"
        }
      ],
      "tags": {
        "<label>": {
          "constraints": [
            {
              "ref": "$atomic"
            },
            {
              "ref": "$hasIdentifiedLabel"
            }
          ]
        }
      }
    }
  }
}
