Skip to content

Instantly share code, notes, and snippets.

@cbejensen
Created April 15, 2019 16:19
Show Gist options
  • Save cbejensen/e507050ef40ff60e681c0a992c72e033 to your computer and use it in GitHub Desktop.
Save cbejensen/e507050ef40ff60e681c0a992c72e033 to your computer and use it in GitHub Desktop.
Check for support of :focus-within
let supportsCSSFocusWithin = false
try {
document.querySelector(':focus-within')
} catch (err) {
supportsCSSFocusWithin = false
}
const wrapper = document.querySelector('wrapper')
wrapper.addEventListener('focusin', e => {
if (!supportsCSSFocusWithin) {
// handle it
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment