-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add focus section to shadow dom article #3255
Conversation
|
||
**Result** | ||
|
||
<img src="images/delegateFocusTrue.png" title="delegatesFocus: true behavior"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the blue border supposed to be the default focus outline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I want to illustrate the how the styles are affected inside SD and outside of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wasn't immediately clear to me. You might add a note mentioning that
|
||
The `focus` event will look like it came from `<x-focus>`, not the `<input>`. Similarly, `document.activeElement` will be `<x-focus>`. If the shadow root was created with `mode:'open'` (see [closed mode](#closed)), you'll also be able access the internal node that gained focus: | ||
|
||
document.activeElement.shadowRoot.activeElement // only works with open mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the focused element is like 10 shadow roots deep? do I have to keep calling activeElement.shadowRoot.activeElement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have to call it, recursively, until it reaches the end.
There is no deep version for activeElement.
The issue is filed here WICG/webcomponents#104.
R: @TakayoshiKochi for focus. |
Looks like there are still some comments. @ebidel can you sort and verify everything looks as it should https://pr-3255-dot-weasel-dot-web-central.appspot.com/ then remove the DO NOT MERGE label and i'll merge and push. |
PTAL |
R: @robdodson @hayatoito @petele