-
Notifications
You must be signed in to change notification settings - Fork 75
New rule: First focusable element is link to non-repeated content #1539
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
base: develop
Are you sure you want to change the base?
Conversation
|
||
- the element is part of [sequential focus navigation][]; and | ||
- the element is [visible][] when [focused][]; and | ||
- it is possible to [fire a click event][] at the element by use of keyboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying from https://github.com/act-rules/act-rules.github.io/pull/421/files#r562630136
Under what circumstance would this not be true? This one is a little tricky. What do you mean with "by use of the keyboard"? If I have an on-screen cursor that I control using arrow keys, and use space to fire a click event from the cursor, does that count? Arguably it would, but I suspect that's not what you mean. Additionally, are you expecting the click event to be fired when the element is focused? Could event bubbling be involved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that a mouse-emulator should count. It's a separate assistive technology and I don't think that it should be taken into account.
If such an emulator would count, then we could argue that every thing satisfies 2.1.1 as soon as users have such an emulator. This is quite clearly not the intend of 2.1.1…
I think rules only test what is part of the test subject (usually a web page).
Now, if a web page implements a mouse emulation with keyboard, that is another question. I would say that such a page does satisfy 2.1.1 (maybe not in a very good way, however). In Scrollable element is keyboard accessible, we do have an assumption (maybe a bit weak) around this idea. (I would argue that currently a page with a mouse emulation implemented could fail the rule but satisfy 2.1.1 and it's not completely clear that this is caught by the assumption).
Anyway, here, if a page implements a mouse emulation, then yes, you can fire the click event by use of keyboard only. But that is not always the case.
Foo
Is passing the first two conditions (it is part of sequential focus navigation, and visible when focused), but not the 3rd (that may be browser dependant, but on Chrome I do not manage to fire the click event with space or enter even when the element has focus). So I do not think that this condition is always true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can take another approach.
To meet the expectation of the rule, the element needs to be activated (so that a change of focus can be evaluated). So, for this rule, we don't need to check if it is possible to activate (fire a click event at) an element twice.
I suggest we drop this definition and move being part of the sequential focus navigation and being visible when focused to the expectations of the rule. The third condition in this definition is already checked in the rule's expectation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The important point in this third condition is not that the element can be activated, but the fact that it can be done by using the keyboard. This is what fails Failed Example 7, and is not checked elsewhere in the rule.
Without this condition,
<div role="link" onclick="location.assign('#main');" tabindex="0" id="skip-link">Skip to main contentdiv>
would pass the rule, which is a bit sad for a best practice rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. I was focusing too much on the "how can we know if we can fire an event at a target" and leaving out the "using the keyboard" parte.
Still, what about changing the condition in the expectation to
- when the element is [activated][] by use of keyboard, focus moves [just before][] a node of [non-repeated content after repeated content][]; and
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Interesting…
I'm afraid that this condition is dangerously close to triggering a universal quantification on an empty set… The almost similar
If the element is activated by use of keyboard, focus moves…
for example, would pass on elements that are not keyboard-actionable (or we can make this even more explicit with "every time the element is activated by use of keyboard, …")
Now, clearly, the current formulation also has that problem… It can be rephrased the same way as
Every time the element is activated, …
and would pass on a non-activatable element (whatever that means…) But the current version does have a condition that the element is actionable (as part of the keyboard actionable requirement…)
Also, to continue discussion… If I open the devtools (Ctrl+Shift+I, usually), go to the console, and type in some document.getElement(foo).sendEvent(click)
, is that keyboard activation? I guess we're safe-ish because that uses something (devtools) which is not part of the content (the web page), so if that gives extra power, we don't care (the same way that we wouldn't take into account a browser extension that allows to move the pointer with the k.eyboard).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this can be programmatically checked. I would like this to be a manual rule.
- the element is [included in the accessibility tree][]; and | ||
- the element is a [semantic link][]; and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referencing back to our conversation of mechanism, I don't think these two are required. Actually if a skip mechanism was a button, I'm not entirely sure it'd even fail WCAG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm convinced that a skip button wouldn't fail WCAG (and would pass Document has an instrument to move focus to non-repeated content), but this is best practice matching G1 which does require a link as skip mechanism.
The technique does not explicitly mention keyboard activation nor inclusion in the accessibility tree, but does mention "keyboard only users" and "screen reader users" for which the link would be useless without these conditions. I'm rather keen to keep them in a best practice rule (especially since this does not refer to "instrument", contrary to the other cases discussed, and so we cannot rely on that definition to tell that "instrument" must be accessible).
|
||
## Expectation 1 | ||
|
||
Each test target has a non-empty [sequential focus navigation order][sequential focus navigation]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be part of the applicability? I don't quite see the logic of failing a page without focusable content.
_rules/first-focusable-element-is-link-to-non-repeated-content-8a213c.md
Show resolved
Hide resolved
- the element is [included in the accessibility tree][]; and | ||
- the element is a [semantic link][]; and | ||
- when the element is [activated][], focus moves [just before][] a node of [non-repeated content after repeated content][]; and | ||
- the element has an [accessible name][] that communicates that it skips to the main content area. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too seems a bit out of scope for the technique.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's essentially the 2nd test in the technique ("Check that the description of the link communicates that it links to the main content.")
@WilcoFiers good catch on the presence of repeated content. That was lost in various iterations… |
Extracting the separate rule from #421 .
Closes issue(s):
Need for Final Call:
This will require a 2 weeks Final Call (new rule)
Pull Request Etiquette
When creating PR:
develop
branch (left side).After creating PR:
Rule
,Definition
orChore
.When merging a PR:
How to Review And Approve