Re: [webcomponents] [Shadow] activeElement behavior seems to break encapsulation (#358)

Yeah, `x-foo.shadowRoot.activeElement` could point to slot to which `focusable2' is assigned, just like `document.activeElement` is adjusted to the shadow host which contains a real focused element in its shadow.

But the point is that we want "when `.activeElement` changes, please notify the pointed element via `focus/blur` event" behavior.

The second paragraph in my last comment was confusing. Let me explain more.
@bicknellr @sorvell @kevinpschaaf if you remember the rationale for the focus event behavior more,
feel free to chime in.

This behavior is for consistency between `document.activeElement` and `ShadowRoot.activeElement` about `focus/blur` event and `activeElement` value change

Without Shadow DOM, `document.activeElement` always points to a focused element if any,
and once the focus moves, a `focus` element is dispatched and `document.activeElement` changes
to point the new focused element.

If we put an element with shadow DOM, and some element in the shadow gets focus,
`document.activeElement` points to the shadow host, but no element outside the
shadow root gets `focus` event. - This is the motivation for the behavior, to get `focus` event
to shadow host.  If the focus move happened within the same shadow tree, the host do not
have to get `focus` event.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/358#issuecomment-179139000

Received on Wednesday, 3 February 2016 10:03:40 UTC