fix: enable focus-visible in Firefox 90 (#2075)

This commit is contained in:
Nolan Lawson 2021-07-16 07:14:15 -07:00 committed by GitHub
parent d84f4604ad
commit d30f7f4b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -1,8 +1,8 @@
import { thunk } from './thunk.js' import { thunk } from './thunk.js'
import { supportsSelector } from './supportsSelector.js' import { supportsSelector } from './supportsSelector.js'
import { isFirefox } from './userAgent/isFirefox.js' import { isFirefoxPre90 } from './userAgent/isFirefoxPre90.js'
// Disabling for now in Firefox due to bugs: // Disabling in Firefox <90 due to bugs:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1699154 // https://bugzilla.mozilla.org/show_bug.cgi?id=1699154
// https://bugzilla.mozilla.org/show_bug.cgi?id=1711057 // https://bugzilla.mozilla.org/show_bug.cgi?id=1711057
export const supportsFocusVisible = thunk(() => (!isFirefox() && supportsSelector(':focus-visible'))) export const supportsFocusVisible = thunk(() => (!isFirefoxPre90() && supportsSelector(':focus-visible')))

View File

@ -1,5 +0,0 @@
import { thunk } from '../thunk.js'
export const isFirefox = thunk(() => {
return process.browser && typeof InstallTrigger !== 'undefined' // https://stackoverflow.com/a/9851769/680742
})

View File

@ -0,0 +1,9 @@
import { thunk } from '../thunk.js'
export const isFirefoxPre90 = thunk(() => {
return process.browser &&
// https://stackoverflow.com/a/9851769/680742
typeof InstallTrigger !== 'undefined' &&
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at#browser_compatibility
!Array.prototype.at
})