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
Unclear what counts as interactive in Presentational Roles Conflict Resolution #1270
Comments
There's some related discussion in #1192. |
@carmacleod Thanks - I added a couple of edits above. One thing that seems potentially confusing is toggling between role=none and the native role depending on other attributes or CSS styles (although this happens with the current definition if you add a global ARIa attribute) |
I wouldn’t expect any of these examples to be valid. A button in a disabled state is still a button, and you can’t have something be both exposed as presentational while also being exposed as disabled. Hiding an element from the accessibility tree / from being visible again doesn’t change its role. It also doesn't exactly make it non-interactive either. For instance, the following hidden button can still be "clicked" by another button to produce the alert. <button class=one>try me</button>
<button hidden>Hidden</button>
<script>
var f = document.querySelector('[hidden]');
var b = document.querySelector('.one')
f.addEventListener('click', function () {
alert('I am hiden')
})
b.addEventListener('click', function () {
f.click()
})
</script> |
Yep, I think any examples showing Presentational Roles Conflict should be invalid
That's how I expected it to work, but that's not how it works in the Chrome or Firefox accessibility inspectors:
Edit added Safari and more attribute tests
It usually doesn't matter for hidden elements since they're not in the a11y tree. It might matter for hidden elements referenced by aria-labelledby since step 2E in accname takes role into account. |
what's interesting about that is those results don't hold true for so the following are both still exposed as buttons
|
Did a bit of digging through WebKit browser code. WebKit never overrides role=none on natively disabled form controls : Edit: also overrides role=presentational / role=none if global ARIA attributes present
https://github.com/WebKit/webkit/blob/master/Source/WebCore/html/HTMLFormControlElement.cpp#L355
|
Chromium works similarly but also takes global ARIA attributes into account:
|
Yeh, this confirms my suspicion
Chrome is ignoring the presentation role because of the aria attribute itself, and not because of what the aria attribute represents. |
And Firefox ignores role=presentation / role=none if:
See comment from James Teh #1192 (comment) https://dxr.mozilla.org/mozilla-central/source/accessible/base/nsAccessibilityService.cpp#1036
|
In current implementations disabling a button with
This causes the button role to change as controls are enabled/disabled. This is confusing for the user and causes weird authoring inconsistencies like this:
In the worst case some buttons disappear completely from the a11y tree in Chrome/Safari when disabled:
This doesn't happen in Firefox because it uses the Edit: I think it would be better if the spec was changed to ensure role doesn't change when control state changes. Something like this might work:
|
I've matched this issue with #1192 so that they hopefully get resolved together. |
It's not clear what "interactive" means in the following sentence:
https://w3c.github.io/aria/#conflict_resolution_presentation_none
Does it mean something that currently accepts user input (e.g. not disabled or hidden) or does it mean interactive elements (which may be hidden or disabled) such as those listed in https://html.spec.whatwg.org/multipage/dom.html#interactive-content
Edit: If the disabled attribute blocks conflict resolution, then adding/removing the disabled attribute changes the role. This may be undesirable.
Edit: If the hiding the element blocks conflict resolution, then showing/hiding the element also changes the role. This starts getting difficult when you account for things obscuring the element like modal boxes coded in HTML.
The text was updated successfully, but these errors were encountered: