Skip to content

Commit

Permalink
fix: Explicit form regions should not be ignored (#8)
Browse files Browse the repository at this point in the history
With some help :-) I think we've got to the bottom of [how forms and regions, `<form>` and `<section>` should be recognised](#2 (comment)).

This also includes some updates to the expectation metadata schema, and hopefully helpful links to give this background info.

Further, the schema requires the root of the expectations themselves to be an array.

Closes #2.
  • Loading branch information
matatk authored Jun 3, 2019
1 parent 1fbae26 commit 93f3dc1
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 30 deletions.
87 changes: 76 additions & 11 deletions combined/expectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@
},
"expected": []
},
"form-alone-is-ignored": {
"meta": {
"name": "Unlabelled form is ignored"
},
"expected": []
},
"form-aria-label": {
"meta": {
"name": "Form with aria-label is recognised"
"name": "Form with aria-label is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand All @@ -256,7 +256,13 @@
},
"form-aria-labelledby": {
"meta": {
"name": "Form with aria-labelledby is recognised"
"name": "Form with aria-labelledby is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand All @@ -267,6 +273,41 @@
}
]
},
"form-element-alone-is-ignored": {
"meta": {
"name": "Unlabelled <form> element is ignored",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": []
},
"form-unlabelled-with-explicit-role": {
"meta": {
"name": "Form with no label, but an explicit role, is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
},
{
"url": "https://w3c.github.io/core-aam/#details-id-22",
"text": "<div role=\"form\"> gets a landmark"
}
]
},
"expected": [
{
"type": "landmark",
"role": "form",
"label": "null",
"selector": "body > div"
}
]
},
"header-containing-nav-nav-search": {
"meta": {
"name": "Header with nested landmarks, and others are recognised"
Expand Down Expand Up @@ -526,13 +567,25 @@
},
"region-alone-is-ignored": {
"meta": {
"name": "Unlabelled region is ignored"
"name": "Unlabelled region is ignored",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": []
},
"region-aria-label": {
"meta": {
"name": "Region with aria-label is recognised"
"name": "Region with aria-label is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand All @@ -545,7 +598,13 @@
},
"region-aria-labelledby": {
"meta": {
"name": "Region with aria-labelledby is recognised"
"name": "Region with aria-labelledby is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand Down Expand Up @@ -585,6 +644,12 @@
"label": null,
"selector": "#complementary",
"contains": [
{
"type": "landmark",
"role": "form",
"label": null,
"selector": "#form"
},
{
"type": "landmark",
"role": "search",
Expand Down
15 changes: 10 additions & 5 deletions combined/fixtures.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ <h2 id="head-appendix-b">Detailed schematics</h2>
</footer>
</blockquote>
</div>
<div data-test-id="form-alone-is-ignored">
<form action="blah">
<p>The form with no name.</p>
</form>
</div>
<div data-test-id="form-aria-label">
<form action="blah" aria-label="Contact Us">
<p>A form with a name.</p>
Expand All @@ -184,6 +179,16 @@ <h1 id="form-heading">Report a Fault</h1>
<p>A form with a visible name for all folk!</p>
</form>
</div>
<div data-test-id="form-element-alone-is-ignored">
<form action="blah">
<p>The form with no name.</p>
</form>
</div>
<div data-test-id="form-unlabelled-with-explicit-role">
<div role="form">
<p>The form with no name, but an explicit role.</p>
</div>
</div>
<div data-test-id="header-containing-nav-nav-search">
<header>
Page Header
Expand Down
6 changes: 0 additions & 6 deletions expectations/form-alone-is-ignored.json

This file was deleted.

8 changes: 7 additions & 1 deletion expectations/form-aria-label.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"meta": {
"name": "Form with aria-label is recognised"
"name": "Form with aria-label is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand Down
8 changes: 7 additions & 1 deletion expectations/form-aria-labelledby.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"meta": {
"name": "Form with aria-labelledby is recognised"
"name": "Form with aria-labelledby is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand Down
12 changes: 12 additions & 0 deletions expectations/form-element-alone-is-ignored.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"meta": {
"name": "Unlabelled <form> element is ignored",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": []
}
23 changes: 23 additions & 0 deletions expectations/form-unlabelled-with-explicit-role.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"meta": {
"name": "Form with no label, but an explicit role, is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
},
{
"url": "https://w3c.github.io/core-aam/#details-id-22",
"text": "<div role=\"form\"> gets a landmark"
}
]
},
"expected": [
{
"type": "landmark",
"role": "form",
"label": "null",
"selector": "body > div"
}
]
}
8 changes: 7 additions & 1 deletion expectations/region-alone-is-ignored.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"meta": {
"name": "Unlabelled region is ignored"
"name": "Unlabelled region is ignored",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": []
}
8 changes: 7 additions & 1 deletion expectations/region-aria-label.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"meta": {
"name": "Region with aria-label is recognised"
"name": "Region with aria-label is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand Down
8 changes: 7 additions & 1 deletion expectations/region-aria-labelledby.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"meta": {
"name": "Region with aria-labelledby is recognised"
"name": "Region with aria-labelledby is recognised",
"links": [
{
"url": "https://github.com/matatk/page-structural-semantics-scanner-tests/issues/2#issuecomment-497938545",
"text": "Overall info on forms and regions"
}
]
},
"expected": [
{
Expand Down
6 changes: 6 additions & 0 deletions expectations/roles-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
"label": null,
"selector": "#complementary",
"contains": [
{
"type": "landmark",
"role": "form",
"label": null,
"selector": "#form"
},
{
"type": "landmark",
"role": "search",
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions fixtures/form-unlabelled-with-explicit-role.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div role="form">
<p>The form with no name, but an explicit role.</p>
</div>
</body>
</html>
21 changes: 18 additions & 3 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,29 @@
"type": "string"
},
"links": {
"type": "array"
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"pattern": "^https?://"
},
"text": {
"type": "string"
}
},
"required": ["url", "text"]
}
}
},
"required": [ "name" ]
"required": ["name"]
},

"expected": {
"type": "array"
}
},
"required": [ "meta", "expected" ]
"required": ["meta", "expected"]
}

0 comments on commit 93f3dc1

Please sign in to comment.