Closed Bug 1026125 Opened 10 years ago Closed 10 years ago

ShadowRoot nodes don't get accessible objects

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: eeejay, Assigned: eeejay)

References

Details

Attachments

(2 files, 1 obsolete file)

This seems to be a regression by the changes introduced in bug 992521.
I think this is all we need. I'm going to create a mochitest, and then submit for review.
I'm curious why IsInDoc() doesn't work for them since it works for everything else (native anonymous content, XBL). Also curious if this one correlates to bug 997752.
XBL actually does get set in doc, so IsInDoc() would return true for XBL anonymous content. It makes a little more sense for XBL to be marked in document because you can walk the parent chain of elements in anonymous content and end up in the document. Walking the parent chain of elements in the shadow DOM would terminate at the ShadowRoot.
Attachment #8440914 - Attachment is obsolete: true
Attachment #8441489 - Flags: review?(surkov.alexander)
Attachment #8441489 - Flags: feedback?(wchen)
(In reply to William Chen [:wchen] from comment #3)
> XBL actually does get set in doc, so IsInDoc() would return true for XBL
> anonymous content. It makes a little more sense for XBL to be marked in
> document because you can walk the parent chain of elements in anonymous
> content and end up in the document. Walking the parent chain of elements in
> the shadow DOM would terminate at the ShadowRoot.

nsINode::GetParent() doesn't work to cross from anonymous to explicit content but you can do GetFlattenParent() sure. Do you say that there's no way to find explicit parent (insertion point) having shadow DOM node? If no then probably shadow content is not much different from XBL content.

Anyway, can we have something nicer than GetCrossShadowCurrentDoc check to see whether the node is attached to the document?
Comment on attachment 8441489 [details] [diff] [review]
Check for current document accross shadow root when creating accessible.

Review of attachment 8441489 [details] [diff] [review]:
-----------------------------------------------------------------

test looks good, I'm not happy though with GetCrossShadowCurrentDoc call as replacement to the check whether node is in document but somebody from content/dom team should help here.
Attachment #8441489 - Flags: review?(surkov.alexander) → review+
> Anyway, can we have something nicer than GetCrossShadowCurrentDoc check to
> see whether the node is attached to the document?

other than being slightly slower in the common case of not shadow dom what's wrong with it?
name, I would be happy having IsInDoc working here, at least it would be consistent with XBL and native anon content
(In reply to alexander :surkov from comment #5)
> nsINode::GetParent() doesn't work to cross from anonymous to explicit
> content but you can do GetFlattenParent() sure. Do you say that there's no
> way to find explicit parent (insertion point) having shadow DOM node? If no
> then probably shadow content is not much different from XBL content.
GetParent() will walk out of anonymous content, see the attached example. The problem with putting shadow content in document is that we have some code that expects that if IsInDoc() is true, we can walk the parent chain to reach the document node. This is true with anonymous content, but not true with nodes in the shadow DOM.
 
> Anyway, can we have something nicer than GetCrossShadowCurrentDoc check to
> see whether the node is attached to the document?
For now, that's probably the best we have, bug 1026047 will likely add a similar equivalent for IsInDoc().
Attachment #8441489 - Flags: feedback?(wchen) → feedback+
(In reply to William Chen [:wchen] from comment #9)

> GetParent() will walk out of anonymous content, see the attached example.

maybe DOM node has some trick for this, I referred to bug 653881.

> The problem with putting shadow content in document is that we have some
> code that expects that if IsInDoc() is true, we can walk the parent chain to
> reach the document node.

I see, that easy can be a problem for a11y as well since our code relies on working GetParent(). It'd be good to have tests to check tree mutations, in case if we have tree update problems
 
> > Anyway, can we have something nicer than GetCrossShadowCurrentDoc check to
> > see whether the node is attached to the document?
> For now, that's probably the best we have, bug 1026047 will likely add a
> similar equivalent for IsInDoc().

ok
https://hg.mozilla.org/integration/mozilla-inbound/rev/47d6ee269692

We could follow up with a change once we have a working IsInDoc equivalent for shadow dom.
Assignee: nobody → eitan
Bug 1026047 is the meta bug to sort out the whole IsInDoc/GetCurrentDoc handling.
https://hg.mozilla.org/mozilla-central/rev/47d6ee269692
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: