[w3c/webcomponents] Should host with `delegatesFocus` true keep the previous focused element focused if it's a shadow-including inclusive ancestor of the host? (#840)

Just noticed this behavior in Blink when re-reading the focus code one last time for `delegatesFocus` specs https://github.com/whatwg/html/pull/4796.
So the case is like this:

```html
<div #host>
 #shadowRoot delegatesFocus=true
  <div tabindex=0 id=foo>foo</div>
  <div tabindex=0 id=bar>bar</div>
```
The currently focused element is `#bar`, and then we call `host.focus()`. In Blink right now we would keep the focus on `#bar` and not focus on anything else. In fact we would keep the focused element whenever we try to focus on `#host` if any of `host`'s shadow-including descendant is the currently focused element.

This seems weird and we aren't doing the "keep the current focused element" in any other case (CMIIW), so I propose we don't spec this behavior, and instead do the focus delegation in `host` no matter what (with the delegation methods from https://github.com/w3c/webcomponents/issues/830#issuecomment-532514644)


cc @domenic @rniwa @smaug---- @annevk @ekashida

-- 
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/840

Received on Friday, 20 September 2019 07:10:08 UTC