Closed Bug 1117535 Opened 9 years ago Closed 6 years ago

wrong activeElement when focusing element in ShadowDOM

Categories

(Core :: DOM: Core & HTML, defect)

34 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1429656

People

(Reporter: mail, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:34.0) Gecko/20100101 Firefox/34.0
Build ID: 20141125180439

Steps to reproduce:

1. created a ShadowDOM structure (see attached test case)
2. focused element within a ShadowRoot
3. verified focused element with document.activeElement

Live test case: http://medialize.github.io/ally.js/tests/browser-bugs/gecko-shadow-dom-active-element.html


Actual results:

When focusing a shadowed element (i.e. an element within a ShadowRoot) that element is exposed to document.activeElement - i.e. document.activeElement leaks the content of the ShadowRoot.

Also there is no ShadowRoot.activeElement - which is necessary to actually get to the focused element from the adjusted target (i.e. the ShadowHost).

Also reproducible in Firefox Nightly 37.0a1 (2015-01-04).


Expected results:

document.activeElement should point to the (top most) ShadowHost containing the focused element. ShadowRoot.activeElement should point to the focused element in that ShadowRoot (as document.activeElement does for the document).
Attached file test case
Gabor, do you know what's going on here? (after bug 777674 you are now the person I associate with shadow dom implementation stuff... :-) )
Component: Untriaged → DOM
Flags: needinfo?(gkrizsanits)
Keywords: testcase
Product: Firefox → Core
See Also: → 1117544
See Also: → 1117552
(In reply to :Gijs Kruitbosch from comment #2)
> Gabor, do you know what's going on here? (after bug 777674 you are now the
> person I associate with shadow dom implementation stuff... :-) )

I think you would have better luck with William or Olli, but I'm happy if you keep me in the loop :)

I think Olli worked on making the focusing stuff work, so I'm passing the needInfo flag to him. He might know something off the top of his head, otherwise I can dive into this.
Flags: needinfo?(gkrizsanits) → needinfo?(bugs)
I thought we had a bug open for this, but maybe not.
Flags: needinfo?(bugs)
It may also be of interest that if document.activeElement is not cleaned up (reset to document.body) when he ShadowRoot that element belonged to is removed. In that case document.activeElement.blur() does nothing and the only way out of that hole is to first focus another element in the document itself, before running document.activeElement.blur().
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: