Fix bug in isSafari helper method (#42826)

This helper previously returned `true` for me locally in Google Chrome.
This commit is contained in:
Ólafur Páll Geirsson 2022-10-11 19:00:22 +02:00 committed by GitHub
parent 11df2e7204
commit 202a6e7d89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -3,7 +3,7 @@ export function isChrome(): boolean {
}
export function isSafari(): boolean {
return !!window.navigator.userAgent.match(/safari/i)
return !!window.navigator.userAgent.match(/safari/i) && !isChrome()
}
export function isFirefox(): boolean {

View File

@ -1,4 +1,4 @@
import { isMacPlatform, getBrowserName } from '@sourcegraph/common'
import { isMacPlatform, isSafari } from '@sourcegraph/common'
import { KeyboardShortcut } from '../keyboardShortcuts'
@ -56,8 +56,7 @@ export const KEYBOARD_SHORTCUTS: KEYBOARD_SHORTCUT_MAPPING = {
},
fuzzyFinderSymbols: {
title: 'Fuzzy find symbols',
// NOTE: `isSafari()` returns true in Google Chrome on macOS.
keybindings: [{ held: getBrowserName() === 'safari' ? ['Mod', 'Shift'] : ['Mod'], ordered: ['o'] }],
keybindings: [{ held: isSafari() ? ['Mod', 'Shift'] : ['Mod'], ordered: ['o'] }],
hideInHelp: true,
},
copyFullQuery: {