Closed
Bug 1487311
Opened 7 years ago
Closed 7 years ago
Accessibility doesn't associate ids in shadow DOM
Categories
(Core :: Disability Access APIs, defect, P3)
Core
Disability Access APIs
Tracking
()
VERIFIED
FIXED
mozilla65
| Tracking | Status | |
|---|---|---|
| firefox65 | --- | verified |
People
(Reporter: Jamie, Assigned: surkov)
References
Details
Attachments
(1 file, 2 obsolete files)
|
20.85 KB,
patch
|
Jamie
:
review+
smaug
:
superreview+
|
Details | Diff | Splinter Review |
STR:
1. Open this test case:
data:text/html,<div id="host"></div><script>shadow = host.attachShadow({mode: 'open'}); shadow.innerHTML = `<div id="label">Label</div><input type="text" aria-labelledby="label">`;</script>
2. Use the Accessibility Inspector to examine the name of the input.
Expected: "label"
Actual: null
Same applies for a <label for>:
shadow.innerHTML = `<label for="input">label</label><input type="text" id="input">`;
In fixing this, we need to make sure that we don't support id association the other way. That is, I don't think we want ARIA properties in an outer document to be able to refer to ids in a shadow DOM.
Comment 1•7 years ago
|
||
Any news on this?
Comment 2•7 years ago
|
||
Note, Document and ShadowRoot have their own ID tracking.
https://searchfox.org/mozilla-central/rev/de7676288a78b70d2b9927c79493adbf294faad5/dom/base/DocumentOrShadowRoot.h#219
That doesn't cross shadow boundaries.
| Assignee | ||
Comment 4•7 years ago
|
||
We should introduce dependent IDs hash per shadow root similar to what we do for DocAccessible::mDependentIDsHash. It could be a map between ShadowRootOrDocument and dependent IDs hashes.
I will try to play with this week, if no one feels hot to pick it up :)
Flags: needinfo?(surkov.alexander)
| Assignee | ||
Comment 5•7 years ago
|
||
r? from jamie, f? from olli for sanity check
Assignee: nobody → surkov.alexander
Flags: needinfo?(jteh)
Attachment #9019653 -
Flags: review?(jteh)
Attachment #9019653 -
Flags: feedback?(bugs)
| Reporter | ||
Comment 6•7 years ago
|
||
Comment on attachment 9019653 [details] [diff] [review]
patch
Review of attachment 9019653 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks!
::: accessible/generic/DocAccessible-inl.h
@@ +224,5 @@
> + if (hash) {
> + AttrRelProviders* providers = hash->Get(aID);
> + if (providers && providers->Length() == 0) {
> + hash->Remove(aID);
> + mDependentIDsHashes.Remove(docOrShadowRoot);
This removes the DependentIDsHashtable for the entire DocumentOrShadowRoot if there are no providers for a given id. But there might still be providers for *other ids*. I think there needs to be an additional check here for the size of hash?
@@ +229,5 @@
> + }
> + }
> +}
> +
> +
nit: Extraneous blank line.
::: accessible/generic/DocAccessible.cpp
@@ +120,5 @@
> + for (auto iter = tmp->mDependentIDsHashes.Iter(); !iter.Done(); iter.Next()) {
> + auto dependentIDsHash = iter.UserData();
> + for (auto jter = dependentIDsHash->Iter(); !iter.Done(); iter.Next()) {
> + AttrRelProviders* providers = jter.UserData();
> + for (int32_t jdx = providers->Length() - 1; jdx >= 0; jdx--) {
nit: I'd prefer clearer names than iter, jter and jdx. Perhaps depidsIter, provsIter and provIter? At the very least, keeping the original pattern, jdx should be renamed kdx.
::: accessible/generic/DocAccessible.h
@@ +677,5 @@
> + typedef nsTArray<nsAutoPtr<AttrRelProvider> > AttrRelProviders;
> + typedef nsClassHashtable<nsStringHashKey, AttrRelProviders> DependentIDsHashtable;
> +
> + /**
> + * Reutnrs/creates/removes attribute relation providers associated with
nit: Reutnrs -> Returns
::: accessible/tests/mochitest/relations/test_shadowdom.html
@@ +22,5 @@
> + // explicit content
> + let label = iframeDoc.getElementById("label");
> + let element = iframeDoc.getElementById("element");
> + //testRelation(label, RELATION_LABEL_FOR, element);
> + //testRelation(element, RELATION_LABELLED_BY, label);
Why are these tests commented out? I think they're important. :)
Attachment #9019653 -
Flags: review?(jteh)
| Assignee | ||
Comment 7•7 years ago
|
||
Attachment #9019653 -
Attachment is obsolete: true
Attachment #9019653 -
Flags: feedback?(bugs)
Attachment #9019915 -
Flags: review?(jteh)
Attachment #9019915 -
Flags: feedback?(bugs)
| Reporter | ||
Comment 8•7 years ago
|
||
Comment on attachment 9019915 [details] [diff] [review]
patch
Review of attachment 9019915 [details] [diff] [review]:
-----------------------------------------------------------------
r=me with concerns answered/addressed.
::: accessible/tests/mochitest/relations/test_shadowdom.html
@@ +20,5 @@
> + let iframeDoc = document.getElementById("iframe").contentDocument;
> +
> + // explicit content
> + let label = iframeDoc.getElementById("label");
> + let element = iframeDoc.getElementById("element");
Do these currently pass? These ids don't seem to be present in the iframe, unless I'm missing something...
@@ +49,5 @@
> + iframe.id = "iframe";
> + iframe.src = `data:text/html,<html>
> + <body>
> + <div id='shadowcontainer'></div>
> + <${sc}>
Sorry, forgot to ask about this in the last review. Is there a reason you can't just do <script> directly here?
@@ +64,5 @@
> + });
> + </script>
> +<!--
> + <div id='label'></div><div id='element' aria-labelledby='label'></div>
> +-->
I guess this should be in the iframe, but not commented out?
| Assignee | ||
Comment 9•7 years ago
|
||
(In reply to James Teh [:Jamie] from comment #8)
> Comment on attachment 9019915 [details] [diff] [review]
> patch
>
> Review of attachment 9019915 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> r=me with concerns answered/addressed.
>
> ::: accessible/tests/mochitest/relations/test_shadowdom.html
> @@ +20,5 @@
> > + let iframeDoc = document.getElementById("iframe").contentDocument;
> > +
> > + // explicit content
> > + let label = iframeDoc.getElementById("label");
> > + let element = iframeDoc.getElementById("element");
>
> Do these currently pass? These ids don't seem to be present in the iframe,
> unless I'm missing something...
> @@ +64,5 @@
> > + });
> > + </script>
> > +<!--
> > + <div id='label'></div><div id='element' aria-labelledby='label'></div>
> > +-->
>
> I guess this should be in the iframe, but not commented out?
artifacts from debugging, try reports are delaying :) will fix it
> @@ +49,5 @@
> > + iframe.id = "iframe";
> > + iframe.src = `data:text/html,<html>
> > + <body>
> > + <div id='shadowcontainer'></div>
> > + <${sc}>
>
> Sorry, forgot to ask about this in the last review. Is there a reason you
> can't just do <script> directly here?
>
yes, to not confuse the parser
| Assignee | ||
Comment 10•7 years ago
|
||
the tests pass
Attachment #9019915 -
Attachment is obsolete: true
Attachment #9019915 -
Flags: review?(jteh)
Attachment #9019915 -
Flags: feedback?(bugs)
Attachment #9019925 -
Flags: superreview?(bugs)
Attachment #9019925 -
Flags: review?(jteh)
| Reporter | ||
Comment 11•7 years ago
|
||
Comment on attachment 9019925 [details] [diff] [review]
patch
Thanks!
Attachment #9019925 -
Flags: review?(jteh) → review+
Updated•7 years ago
|
Attachment #9019925 -
Flags: superreview?(bugs) → superreview+
Comment 12•7 years ago
|
||
(IIRC there are still other shadow DOM + a11y issues)
| Assignee | ||
Comment 13•7 years ago
|
||
(In reply to Olli Pettay [:smaug] (high review load) from comment #12)
> (IIRC there are still other shadow DOM + a11y issues)
right, but this one is probably the biggest one
Comment 14•7 years ago
|
||
Pushed by surkov.alexander@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/052d5b7a515e
accessibility doesn't assosiate ids in shadow DOM, r=jamie, sr=smaug
Comment 15•7 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Updated•7 years ago
|
Flags: qe-verify+
Comment 17•6 years ago
|
||
Verified as fixed with 65.0b12 on Linux 16.4, Windows 10x64 and MacoS 10.13
Updated•6 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•