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

> If the only reason for the change is The Change Looks Useful, be careful. We should refrain from changing the meaning of the existing API carelessly. 

There is no meaning or existing API since this is about `ShadowRoot`.

The alternative proposal is as follows:
 - `activeElement` on `ShadowRoot` would return the focused element in the shadow tree that contains `ShadowRoot` or the slot through which a focused element is distributed (i.e. a focused element is in the result of the [get distributed nodes algorithm](http://w3c.github.io/webcomponents/spec/shadow/#dfn-get-distributed-nodes-algorithm).

In [the sample](https://github.com/w3c/webcomponents/issues/358#issuecomment-168970241),
- When focusable1 is focused:
  * `document.activeElement` -> focusable1
  * `x-foo.shadowRoot.activeElement` -> `null`
  * `:focus` pseudo class can be applied to:
    * in a document tree: focusable1
    * in a shadow tree: none
- When focusable2 is focused:
  * `document.activeElement` -> focusable2
  * `x-foo.shadowRoot.activeElement` -> slot1
  * `:focus` pseudo class can be applied to:
    * in a document tree: focusable2
    * in a shadow tree: none
- When focusable4 is focused:
  * `document.activeElement` -> x-foo
  * `x-foo.shadowRoot.activeElement` -> focusable4
  * :focus pseudo class can be applied to:
    * in a document tree: x-foo
    * in a shadow tree: focusable4


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/358#issuecomment-202256430

Received on Monday, 28 March 2016 06:28:16 UTC