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

In case someone end up here and need a workaround, this did the job for me:
```ts
deepActiveElement(root: DocumentOrShadowRoot = document): Element | null {
  if (root.activeElement && root.activeElement.shadowRoot && root.activeElement.shadowRoot.activeElement) {
    return deepActiveElement(root.activeElement.shadowRoot);
  }
  return root.activeElement;
}
```

And just call it : `const focusEl = deepActiveElement();`

-- 
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-597802921

Received on Wednesday, 11 March 2020 18:44:03 UTC