fix: disable :focus-visible on Firefox (#2003)

* fix: disable :focus-visible on Firefox

* fix: use unambiguous closure
This commit is contained in:
Nolan Lawson 2021-03-18 07:00:42 -07:00 committed by GitHub
parent 40cb793e81
commit fd321720f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -1,4 +1,7 @@
import { thunk } from './thunk'
import { supportsSelector } from './supportsSelector'
import { isFirefox } from './userAgent/isFirefox'
export const supportsFocusVisible = thunk(() => supportsSelector(':focus-visible'))
// TODO: remove the Firefox check once this bug is fixed
// https://bugzilla.mozilla.org/show_bug.cgi?id=1699154
export const supportsFocusVisible = thunk(() => (!isFirefox() && supportsSelector(':focus-visible')))

View file

@ -0,0 +1,3 @@
export function isFirefox () {
return typeof InstallTrigger !== 'undefined' // https://stackoverflow.com/a/9851769/680742
}