- From: Takayoshi Kochi <notifications@github.com>
- Date: Fri, 25 Mar 2016 04:00:44 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/358/201240392@github.com>
After thinking of https://github.com/w3c/webcomponents/issues/358#issuecomment-180629067 more, I come to think if we have `HTMLSlotElement.activeElement` then it might be okay for `ShadowRoot.activeElement` to a slot within its shadow DOM. I was imagining the following case, and the code is listening `mosuedown` event on shadow root, then uses `ShadowRoot.activeElement` to get where the focus is. If it returns null, the code has to check the exact focused element via `document.activeElement` and recursive `ShadowRoot.activeElement`, then check if the element is under its own slot. ```html <my-menu> #shadow-root <my-item>...</my-item> <my-item>...</my-item> <!-- optional items go here --> <slot></slot> #shadow-root-end <my-optional-item>...</my-optional-item> <my-optional-item>...</my-optional-item> <my-optional-item>...</my-optional-item> </my-menu> ``` The concern is that to implement `ShadowRoot.activeElement` that way (returns slot), the UA native code has to do the similar search which may be a bit costly. What do you think? --- 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-201240392
Received on Friday, 25 March 2016 11:01:16 UTC