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

SC4-1-1-id test procedure may only check first id and requires full page load #46

Closed
EmmaJP opened this issue Oct 12, 2017 · 8 comments
Closed
Assignees

Comments

@EmmaJP
Copy link
Collaborator

EmmaJP commented Oct 12, 2017

Current rule https://github.com/auto-wcag/auto-wcag/blob/master/_rules/SC4-1-1-id.md includes:

Assumptions
no known assumptions

...

Selector

Select all elements that match the following CSS selector: *[id]

Step 1

  • IF there is no list called 'knownIDs':
    • Create an empty list 'knownIDs;
  • IF the value of the ID attribute exists in 'knownIDs':
    • Return step1-fail
  • ELSE:
    • Add the value of the ID attribute of the selected element to 'knownIDs'
    • Return step1-pass

...

Fail: "The ID of this element has occurred before on this page"

@EmmaJP
Copy link
Collaborator Author

EmmaJP commented Oct 12, 2017

I suggest adding this additional assumption, and adjusting the steps and fail/pass as follows:

Assumptions

  • Assumes a full page has loaded to enable comparison.

...

Selector

Select all elements that match the following CSS selector: *[id]

Step 1

If there is no list called 'knownIDs', create an empty list 'knownIDs'.

Step 2

For each element, check if the id attribute value exists in 'knownIDs'.

if yes, return step2-fail

else, add the value for the id attribute of the selected element to 'knownIDs'

Step 3

Confirm there were no fails.

if yes, return step3-pass

...

Fail: "ID [attribute-value] is duplicated on the page."
Pass: "All id attributes are unique on the page."

@WilcoFiers
Copy link
Member

I don't think we need to do step 1. We can simply say to check if the ID matches that of another element selected by this rule that there is a failure. That way we compact things in just one step. WDYT?

@EmmaJP
Copy link
Collaborator Author

EmmaJP commented Oct 16, 2017

So use the node list from the selector as the list of known IDs. That is nice and tidy.

Something like below? With assumption and fail/pass as I previously suggested.

...

Selector

Select all elements that match the following CSS selector: *[id]

Step 1

For each element, check if the id attribute matches any other selected element's id attribute.

if yes, return step1-fail

Step 2

Confirm there were no fails.

if yes, return step2-pass

...

@WilcoFiers
Copy link
Member

You could just do this:

Step 1

Check if the id attribute matches any other selected element's id attribute.

if yes, return step1-fail

Else return step2-pass

@EmmaJP
Copy link
Collaborator Author

EmmaJP commented Oct 16, 2017

Not really, because it should check the whole page before returning a pass. The success criteria requires all IDs in the web-page to be unique, so it cannot pass just because one ID is unique. Hence the additional assumption as well as the additional step before returning a pass.

@WilcoFiers
Copy link
Member

True, but that's handled by aggregation. The selector finds a bunch of elements, those elements are tested one by one, by going through the test steps. Once that's done the results are aggregated. So if any one of them fails, the page fails.

See Aggregation: https://auto-wcag.github.io/auto-wcag/pages/structure/aggregation.html

@EmmaJP
Copy link
Collaborator Author

EmmaJP commented Oct 17, 2017

Sometimes it's useful to know about things like that. Combining all the above gives something like:

...

Assumptions

Assumes a full page has loaded to enable comparison.
...

Selector

Select all elements that match the following CSS selector: *[id]

Step 1

For each element, check if the id attribute matches any other selected element's id attribute.

if yes, return step1-fail

else, return step1-pass

...

Fail: "ID [attribute-value] is duplicated on the page."
Pass: "ID [attribute-value] is unique on the page."

@WilcoFiers
Copy link
Member

This looks good to me. Feel free to create a PR with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants