Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: The <form> element now always exposes the role "form" #547

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions __tests__/src/elementRoleMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ const entriesList = [
[{"name": "em"}, ["emphasis"]],
[{"name": "html"}, ["document"]],
[{"name": "figure"}, ["figure"]],
[{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "form"}, ["form"]],
[{"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "form"}, ["form"]],
[{"attributes": [{"constraints": ["set"], "name": "name"}], "name": "form"}, ["form"]],
[{"name": "form"}, ["form"]],
[{"name": "a"}, ["generic"]],
[{"name": "area"}, ["generic"]],
[{"name": "aside"}, ["generic"]],
Expand Down Expand Up @@ -230,7 +228,7 @@ describe('elementRolesMap', function () {
});
describe('spread operator', function () {
it('should have a specific length', function () {
expect([...elementRoleMap].length).toEqual(113);
expect([...elementRoleMap].length).toEqual(111);
});
test.each([...elementRoleMap])('Testing element: %o', (obj, roles) => {
expect(entriesList).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/roleElementMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const entriesList = [
["document", [{"name": "html"}]],
["emphasis", [{"name": "em"}]],
["figure", [{"name": "figure"}]],
["form", [{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "name"}], "name": "form"}]],
["form", [{"name": "form"}]],
["generic", [{"name": "a"}, {"name": "area"}, {"name": "aside"}, {"name": "b"}, {"name": "bdo"}, {"name": "body"}, {"name": "data"}, {"name": "div"}, {"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "footer"}, {"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "header"}, {"name": "hgroup"}, {"name": "i"}, {"name": "pre"}, {"name": "q"}, {"name": "samp"}, {"name": "section"}, {"name": "small"}, {"name": "span"}, {"name": "u"}]],
["grid", [{"attributes": [{"name": "role", "value": "grid"}], "name": "table"}]],
["gridcell", [{"constraints": ["ancestor table element has grid role", "ancestor table element has treegrid role"], "name": "td"}]],
Expand Down
30 changes: 0 additions & 30 deletions scripts/roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2895,36 +2895,6 @@
"relatedConcepts": [
{
"concept": {
"attributes": [
{
"constraints": ["set"],
"name": "aria-label"
}
],
"name": "form"
},
"module": "HTML"
},
{
"concept": {
"attributes": [
{
"constraints": ["set"],
"name": "aria-labelledby"
}
],
"name": "form"
},
"module": "HTML"
},
{
"concept": {
"attributes": [
{
"constraints": ["set"],
"name": "name"
}
],
"name": "form"
},
"module": "HTML"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there's "superClass": ["landmark"] below, but I'm not sure about that since the form shouldn't be exposed as a landmark region without an accessible name now. Do you have a suggestion about that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until w3c/aria#1764 is resolved I fear it is perhaps ambiguous as to what the expectation is here?

Even once that is resolved, if it transpires that constraints are needed on the superclass then the data structure as it currently stands isn't expressive enough for this afaik as it stands and we'd need a (potentially breaking) change to accomodate that conditional logic. Depending on use-cases for this library, doing such may be YAGNI?

I'm not confident/familiar enough with the concepts in specs to understand if the superclass role in ARIA is relevant to the landmark exposure (or lack of) described in the AAM specs? We might be conflating an inheritance model here with the expectations on what mapping is used by Accessibility APIs (would need to understand if that Accessibility API exposure is driven by the inheritance or not).

Would need someone like @scottaohara (apologies for the out of the blue ping) to help clarify I expect.

Expand Down
36 changes: 0 additions & 36 deletions src/etc/roles/literal/formRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,6 @@ const formRole: ARIARoleDefinition = {
relatedConcepts: [
{
concept: {
attributes: [
{
constraints: [
'set',
],
name: 'aria-label',
},
],
name: 'form',
},
module: 'HTML',
},
{
concept: {
attributes: [
{
constraints: [
'set',
],
name: 'aria-labelledby',
},
],
name: 'form',
},
module: 'HTML',
},
{
concept: {
attributes: [
{
constraints: [
'set',
],
name: 'name',
},
],
name: 'form',
},
module: 'HTML',
Expand Down