wrong activeElement when focusing element in ShadowDOM

UNCONFIRMED
Unassigned

Status

()

Core
DOM
UNCONFIRMED
2 years ago
2 years ago

People

(Reporter: Rodney Rehm, Unassigned)

Tracking

(Blocks: 1 bug, {testcase})

34 Branch
x86
Mac OS X
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
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).
(Reporter)

Comment 1

2 years ago
Created attachment 8543658 [details]
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: → bug 1117544
See Also: → bug 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)

Comment 4

2 years ago
I thought we had a bug open for this, but maybe not.
Blocks: 811542
Flags: needinfo?(bugs)
See Also: → bug 1145910
(Reporter)

Comment 5

2 years ago
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().
You need to log in before you can comment on or make changes to this bug.