WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
138196
Implement :role pseudo selector
https://bugs.webkit.org/show_bug.cgi?id=138196
Summary
Implement :role pseudo selector
Dean Jackson
Reported
2014-10-29 15:56:59 PDT
At TPAC 2014, the CSS WG agreed to add a :role(foo) pseudo-selector to match against the active ARIA role. e.g. :role(button) would match <button> <input type="button"> <input type="submit"> <div role="button"> <div role="something-not-supported button"> etc
http://www.w3.org/TR/wai-aria/roles#button
Attachments
Patch
(7.00 KB, patch)
2014-11-03 06:06 PST
,
Sukolsak Sakshuwong
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-10-29 15:57:33 PDT
<
rdar://problem/18818174
>
Dean Jackson
Comment 2
2014-10-29 16:02:00 PDT
This should go into the spec soon:
http://dev.w3.org/csswg/mediaqueries-4/
Dean Jackson
Comment 3
2014-10-29 16:02:23 PDT
This should go into the spec soon:
http://dev.w3.org/csswg/mediaqueries-4/
Dean Jackson
Comment 4
2014-10-29 16:10:22 PDT
http://lists.w3.org/Archives/Public/www-style/2013Jul/0104.html
Dean Jackson
Comment 5
2014-10-29 16:10:56 PDT
Turns out the Web Inspector already has some code for this.
Dean Jackson
Comment 6
2014-10-29 16:12:50 PDT
Copying some info from Ben into here: Implementing this would involve: extending the CSS Parser to parse :role(), extend CSSSelector to store the information about :role(), extend Element to expose the active role, match the CSSSelector with the active role, ensure the correct style invalidation when the role changes. Since this is a new feature, this also involves writing *a lot* of tests.
Dean Jackson
Comment 7
2014-10-29 16:18:32 PDT
I think the entry point is AccessibilityObject::computedRoleString() which, given an element/node, you get to via something like: if (AXObjectCache* axObjectCache = node->document().axObjectCache()) { AccessibilityObject* axObject = axObjectCache->getOrCreate(node); ...
James Craig
Comment 8
2014-10-29 16:21:56 PDT
Will need to discuss how to move the relevant portions (role/label) out of the accessibility-only code. We don't want to enable all the accessibility logic for everyone.
chris fleizach
Comment 9
2014-10-29 17:30:30 PDT
(In reply to
comment #8
)
> Will need to discuss how to move the relevant portions (role/label) out of > the accessibility-only code. We don't want to enable all the accessibility > logic for everyone.
So is this meant to apply to the resolved role, or the developer role? I can imagine it might be confusing if the resolved role is different from what the user writes down
James Craig
Comment 10
2014-10-29 17:58:07 PDT
(In reply to
comment #9
)
> So is this meant to apply to the resolved role, or the developer role?
Computed role, not the content attribute. This may also be accessed as Element.computedRole() if a related change goes into DOM.
> I can imagine it might be confusing if the resolved role is different from > what the user writes down
There are already attribute selectors, so if the dev needed the content attribute value, they already could already match on [role="whatever"]: <button role="foo">test<button> Would be matched by either: *[role="foo"] *:role(button)
Sukolsak Sakshuwong
Comment 11
2014-11-03 06:06:11 PST
Created
attachment 240844
[details]
Patch
Sukolsak Sakshuwong
Comment 12
2014-11-03 06:13:54 PST
Sorry, I meant to submit this as a separate patch.
James Craig
Comment 13
2019-04-24 17:47:42 PDT
IIRC, we decided this was un-implementable in its current state, and would require an exhaustive rewrite of WebCore. Closing.
James Craig
Comment 14
2023-10-15 16:46:31 PDT
> IIRC, we decided this was un-implementable in its current state, and would require an exhaustive rewrite of WebCore.
A more complete version of that is captured in these comments: -
https://github.com/w3c/csswg-drafts/issues/3596#issuecomment-460135566
-
https://github.com/w3c/csswg-drafts/issues/3596#issuecomment-1763539455
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug