Created
November 3, 2021 14:44
-
-
Save nolanlawson/ef0cebcb48a5cf958d176056486642cd to your computer and use it in GitHub Desktop.
delegatesFocus test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang=en> | |
| <head> | |
| <title>delegatesFocus test</title> | |
| </head> | |
| <body> | |
| <h1>delegatesFocus test</h1> | |
| <div></div> | |
| <pre></pre> | |
| <script> | |
| const div = document.querySelector('div') | |
| const pre = document.querySelector('pre') | |
| div.attachShadow({ | |
| mode: 'open', | |
| delegatesFocus: true | |
| }).innerHTML = ` | |
| <input class="first"> | |
| <input class="second"> | |
| ` | |
| div.shadowRoot.querySelector('.second').focus() | |
| div.focus() | |
| pre.innerHTML = 'focused: ' + div.shadowRoot.activeElement?.className | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment