- From: James Craig <jcraig@apple.com>
- Date: Wed, 03 Jul 2013 12:20:52 -0700
- To: www-style@w3.org
I'd like to request an "applied role" selector. This can't be done with existing attribute substring matching as it relies on the user agent internals to determine a few things.
1. what the default role of a tag is.
2. which role has been applied if multiple roles or invalid roles have been specified in the role attribute.
The following suggested selector:
:role('button')
Would match:
<input type="button">
<input type="password">
<button>
<div role="button">
<div role="button link">
<div role="foo button link">
It would not match:
<div role="link button"> (link role applied, not button)
<div role="buttonfoo"> ("buttonfoo" is not a valid role token)
<button role="link"> (link role overrides the default role for the host language element)
<button role="presentation"> (presentation role—somewhat equivalent to *no* role—overrides the default role for the host language element)
Part of the reason this needs to be a new selector is because whether or not a specific element matches the selector is dependent upon whether or not the rendering engine supports the expected role. For example, using this selector and element combination:
:role('checkbox')
<div role="foo switch checkbox">
In most browsers today, the selector would match, because "foo" and "switch" are not valid ARIA 1.0 roles. However, in an ARIA 1.1-compliant browser, the same selector/element combination would not match, because the updated browser applied the 1.1 "switch" role instead of the fallback 1.0 "checkbox" role.
Thanks,
James
Received on Wednesday, 3 July 2013 19:21:42 UTC