Skip to content

Instantly share code, notes, and snippets.

@jimmont
Created December 13, 2021 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmont/2ecafdff776e0142fe6c4b1b1639ccff to your computer and use it in GitHub Desktop.
Save jimmont/2ecafdff776e0142fe6c4b1b1639ccff to your computer and use it in GitHub Desktop.
interactive content HTML elements where tab through document gives focus
/*
needed to manage tab focus (focusin) events leading to the following selector to adjust;
reference
* https://html.spec.whatwg.org/multipage/dom.html#interactive-content
additional info:
* https://www.tpgi.com/using-the-tabindex-attribute/
* https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
and various linked/related in the above (or simply Google a bit)
*/
function interactivecontent(node=document){
// [tabindex] added for some contexts
return node.querySelectorAll(`[tabindex], a[href], audio[controls], button, details, embed, iframe, img[usemap], input, label, select, textarea, video[controls]`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment