Created
May 15, 2022 08:25
-
-
Save oscarmarina/2a9bc8df3064dcacd264fb86fe6a7268 to your computer and use it in GitHub Desktop.
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> | |
| <meta charset="UTF-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>:focus-visible</title> | |
| <style> | |
| pre { | |
| height: 100px; | |
| width: max-content; | |
| border: solid thick; | |
| padding: 1em; | |
| } | |
| </style> | |
| <!-- https://github.com/w3c/csswg-drafts/issues/5822 | |
| https://bugs.chromium.org/p/chromium/issues/detail?id=1148007#c7 | |
| https://boom-bath.glitch.me/tabindex.html --> | |
| </head> | |
| <body> | |
| <pre id="log"></pre> | |
| <select id="select"> | |
| <option id="foo">foo</option> | |
| <option id="bar">bar</option> | |
| </select> | |
| <script> | |
| setInterval(() => { | |
| const matchingFocusVisible = document.querySelectorAll(':focus-visible'); | |
| // const matchingFocusVisible = document.querySelectorAll(':hover'); | |
| log.innerHTML = | |
| 'Number of elements matching :focus-visible: ' + matchingFocusVisible.length; | |
| if (matchingFocusVisible.length) log.innerHTML += '\nElements matching :focus-visible:'; | |
| for (let i = 0; i < matchingFocusVisible.length; i++) { | |
| log.innerHTML += '\n* [' + i + ']: ' + matchingFocusVisible[i].id + matchingFocusVisible[i].tagName; | |
| } | |
| }, 500); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment