Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(storage): add keyboard shortcuts for storage screens (#45837)

Ali Waseem712cf7e60b29
diff --git a/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx b/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx
index 4d26f70a852..31f3c40adae 100644
--- a/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx
+++ b/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx
@@ -1,8 +1,8 @@
import { useDebounce } from '@uidotdev/usehooks'
import { useParams } from 'common'
-import { ArrowDownNarrowWide, Search } from 'lucide-react'
+import { ArrowDownNarrowWide, RefreshCw, Search } from 'lucide-react'
import { parseAsBoolean, useQueryState } from 'nuqs'
-import { useCallback, useMemo, useState } from 'react'
+import { useCallback, useMemo, useRef, useState } from 'react'
import {
Button,
Card,
@@ -24,12 +24,15 @@ import { CreateBucketButton } from '../NewBucketButton'
import { STORAGE_BUCKET_SORT } from '../Storage.constants'
import { useStoragePreference } from '../StorageExplorer/useStoragePreference'
import { BucketsTable } from './BucketsTable'
+import { useFilesBucketsShortcuts } from './useFilesBucketsShortcuts'
import AlertError from '@/components/ui/AlertError'
import { InlineLink } from '@/components/ui/InlineLink'
+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'
import { useProjectStorageConfigQuery } from '@/data/config/project-storage-config-query'
import { usePaginatedBucketsQuery } from '@/data/storage/buckets-query'
import { IS_PLATFORM } from '@/lib/constants'
import { formatBytes } from '@/lib/helpers'
+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
import { useStorageExplorerStateSnapshot } from '@/state/storage-explorer'
export const FilesBuckets = () => {
@@ -37,6 +40,7 @@ export const FilesBuckets = () => {
const snap = useStorageExplorerStateSnapshot()
const { sortBucket, setSortBucket } = useStoragePreference(snap.projectRef)
+ const searchInputRef = useRef<HTMLInputElement>(null)
const [filterString, setFilterString] = useState('')
const debouncedFilterString = useDebounce(filterString, 250)
const normalizedSearch = debouncedFilterString.trim()
@@ -59,6 +63,7 @@ export const FilesBuckets = () => {
isFetching: isFetchingBuckets,
fetchNextPage,
hasNextPage,
+ refetch: refetchBuckets,
} = usePaginatedBucketsQuery({
projectRef: ref,
search: normalizedSearch.length > 0 ? normalizedSearch : undefined,
@@ -80,6 +85,19 @@ export const FilesBuckets = () => {
}
}, [hasNextPage, isFetchingBuckets, fetchNextPage])
+ const handleRefresh = useCallback(() => {
+ refetchBuckets()
+ }, [refetchBuckets])
+
+ useFilesBucketsShortcuts({
+ searchInputRef,
+ setFilterString,
+ sortBucket,
+ setSortBucket,
+ setCreateVisible: setVisible,
+ onRefresh: handleRefresh,
+ })
+
return (
<>
<PageContainer>
@@ -109,14 +127,21 @@ export const FilesBuckets = () => {
<>
<div className="flex grow justify-between gap-x-2 items-center mb-4">
<div className="flex items-center gap-x-2">
- <Input
- size="tiny"
- className="grow lg:grow-0 w-52"
- placeholder="Search for a bucket"
- value={filterString}
- onChange={(e) => setFilterString(e.target.value)}
- icon={<Search />}
- />
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.LIST_PAGE_FOCUS_SEARCH}
+ label="Search buckets"
+ side="bottom"
+ >
+ <Input
+ ref={searchInputRef}
+ size="tiny"
+ className="grow lg:grow-0 w-52"
+ placeholder="Search for a bucket"
+ value={filterString}
+ onChange={(e) => setFilterString(e.target.value)}
+ icon={<Search />}
+ />
+ </ShortcutTooltip>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button type="default" icon={<ArrowDownNarrowWide />}>
@@ -137,8 +162,27 @@ export const FilesBuckets = () => {
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.STORAGE_BUCKETS_REFRESH}
+ side="bottom"
+ >
+ <Button
+ type="default"
+ icon={<RefreshCw />}
+ loading={isFetchingBuckets}
+ onClick={handleRefresh}
+ >
+ Refresh
+ </Button>
+ </ShortcutTooltip>
</div>
- <CreateBucketButton onClick={() => setVisible(true)} />
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.LIST_PAGE_NEW_ITEM}
+ label="Create new bucket"
+ side="bottom"
+ >
+ <CreateBucketButton onClick={() => setVisible(true)} />
+ </ShortcutTooltip>
</div>
<Card>
diff --git a/apps/studio/components/interfaces/Storage/FilesBuckets/useFilesBucketsShortcuts.ts b/apps/studio/components/interfaces/Storage/FilesBuckets/useFilesBucketsShortcuts.ts
new file mode 100644
index 00000000000..6b6330b7d6c
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/FilesBuckets/useFilesBucketsShortcuts.ts
@@ -0,0 +1,48 @@
+import { Dispatch, RefObject, SetStateAction } from 'react'
+
+import { STORAGE_BUCKET_SORT } from '../Storage.constants'
+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
+import { useShortcut } from '@/state/shortcuts/useShortcut'
+
+interface UseFilesBucketsShortcutsParams {
+ searchInputRef: RefObject<HTMLInputElement>
+ setFilterString: Dispatch<SetStateAction<string>>
+ sortBucket: STORAGE_BUCKET_SORT
+ setSortBucket: (value: STORAGE_BUCKET_SORT) => void
+ setCreateVisible: (value: boolean) => void
+ onRefresh: () => void
+}
+
+export function useFilesBucketsShortcuts({
+ searchInputRef,
+ setFilterString,
+ sortBucket,
+ setSortBucket,
+ setCreateVisible,
+ onRefresh,
+}: UseFilesBucketsShortcutsParams) {
+ useShortcut(
+ SHORTCUT_IDS.LIST_PAGE_FOCUS_SEARCH,
+ () => {
+ searchInputRef.current?.focus()
+ searchInputRef.current?.select()
+ },
+ { label: 'Search buckets' }
+ )
+
+ useShortcut(SHORTCUT_IDS.LIST_PAGE_NEW_ITEM, () => setCreateVisible(true), {
+ label: 'Create new bucket',
+ })
+
+ useShortcut(SHORTCUT_IDS.LIST_PAGE_RESET_FILTERS, () => {
+ setFilterString('')
+ })
+
+ useShortcut(SHORTCUT_IDS.STORAGE_BUCKETS_REFRESH, onRefresh)
+
+ useShortcut(
+ SHORTCUT_IDS.STORAGE_BUCKETS_CLEAR_SORT,
+ () => setSortBucket(STORAGE_BUCKET_SORT.CREATED_AT),
+ { enabled: sortBucket !== STORAGE_BUCKET_SORT.CREATED_AT }
+ )
+}
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx
index f1597e55f7e..ed45a48f378 100644
--- a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx
@@ -45,10 +45,13 @@ import {
import { Input } from 'ui-patterns/DataInputs/Input'
import { STORAGE_SORT_BY, STORAGE_SORT_BY_ORDER, STORAGE_VIEWS } from '../Storage.constants'
+import { useFileExplorerHeaderShortcuts } from './useFileExplorerHeaderShortcuts'
import { useStoragePreference } from './useStoragePreference'
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'
import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
import { useTrack } from '@/lib/telemetry/track'
+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
import { useStorageExplorerStateSnapshot } from '@/state/storage-explorer'
const VIEW_OPTIONS = [
@@ -211,9 +214,9 @@ export const FileExplorerHeader = ({
const [loading, setLoading] = useState({ isLoading: false, message: '' })
const [isPathDialogOpen, setIsPathDialogOpen] = useState(false)
- const [isRefreshing, setIsRefreshing] = useState(false)
const uploadButtonRef = useRef<HTMLInputElement | null>(null)
+ const searchInputRef = useRef<HTMLInputElement>(null)
const previousBreadcrumbs = useRef<string[] | null>(null)
const {
@@ -225,6 +228,8 @@ export const FileExplorerHeader = ({
popOpenedFoldersAtIndex,
fetchFoldersByPath,
refetchAllOpenedFolders,
+ refreshAll,
+ isRefreshing,
addNewFolderPlaceholder,
clearOpenedFolders,
setSelectedFilePreview,
@@ -242,6 +247,17 @@ export const FileExplorerHeader = ({
const backDisabled = columns.length <= 1
const { can: canUpdateStorage } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*')
+ useFileExplorerHeaderShortcuts({
+ uploadButtonRef,
+ searchInputRef,
+ canUpdateStorage,
+ hasBreadcrumbs: breadcrumbs.length > 0,
+ isSearching: snap.isSearching,
+ setIsSearching: snap.setIsSearching,
+ addNewFolderPlaceholder,
+ setView,
+ })
+
const setSortBy = async (value: STORAGE_SORT_BY) => {
setPreferenceSortBy(value)
setSelectedFilePreview(undefined)
@@ -339,9 +355,7 @@ export const FileExplorerHeader = ({
}
const refreshData = async () => {
- setIsRefreshing(true)
- await refetchAllOpenedFolders()
- setIsRefreshing(false)
+ await refreshAll()
}
const onOpenNavigate = () => {
@@ -394,15 +408,17 @@ export const FileExplorerHeader = ({
Navigate
</Button>
)}
- <Button
- size="tiny"
- icon={<RefreshCw />}
- type="text"
- loading={isRefreshing}
- onClick={refreshData}
- >
- Reload
- </Button>
+ <ShortcutTooltip shortcutId={SHORTCUT_IDS.STORAGE_EXPLORER_REFRESH} side="bottom">
+ <Button
+ size="tiny"
+ icon={<RefreshCw />}
+ type="text"
+ loading={isRefreshing}
+ onClick={refreshData}
+ >
+ Reload
+ </Button>
+ </ShortcutTooltip>
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -473,44 +489,57 @@ export const FileExplorerHeader = ({
<div className="hidden">
<input ref={uploadButtonRef} type="file" multiple onChange={onFilesUpload} />
</div>
- <ButtonTooltip
- icon={<Upload size={16} strokeWidth={2} />}
- type="text"
- disabled={!canUpdateStorage || breadcrumbs.length === 0}
- onClick={onSelectUpload}
- tooltip={{
- content: {
- side: 'bottom',
- text: !canUpdateStorage
- ? 'You need additional permissions to upload files'
- : undefined,
- },
- }}
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.STORAGE_EXPLORER_UPLOAD}
+ side="bottom"
+ open={!canUpdateStorage ? false : undefined}
>
- Upload files
- </ButtonTooltip>
- <ButtonTooltip
- icon={<FolderPlus size={16} strokeWidth={2} />}
- type="text"
- disabled={!canUpdateStorage || breadcrumbs.length === 0}
- onClick={() => addNewFolderPlaceholder(-1)}
- tooltip={{
- content: {
- side: 'bottom',
- text: !canUpdateStorage
- ? 'You need additional permissions to create folders'
- : undefined,
- },
- }}
+ <ButtonTooltip
+ icon={<Upload size={16} strokeWidth={2} />}
+ type="text"
+ disabled={!canUpdateStorage || breadcrumbs.length === 0}
+ onClick={onSelectUpload}
+ tooltip={{
+ content: {
+ side: 'bottom',
+ text: !canUpdateStorage
+ ? 'You need additional permissions to upload files'
+ : undefined,
+ },
+ }}
+ >
+ Upload files
+ </ButtonTooltip>
+ </ShortcutTooltip>
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.STORAGE_EXPLORER_NEW_FOLDER}
+ side="bottom"
+ open={!canUpdateStorage ? false : undefined}
>
- Create folder
- </ButtonTooltip>
+ <ButtonTooltip
+ icon={<FolderPlus size={16} strokeWidth={2} />}
+ type="text"
+ disabled={!canUpdateStorage || breadcrumbs.length === 0}
+ onClick={() => addNewFolderPlaceholder(-1)}
+ tooltip={{
+ content: {
+ side: 'bottom',
+ text: !canUpdateStorage
+ ? 'You need additional permissions to create folders'
+ : undefined,
+ },
+ }}
+ >
+ Create folder
+ </ButtonTooltip>
+ </ShortcutTooltip>
</div>
<div className="h-6 shrink-0 border-r border-control" />
<div className="flex shrink-0 items-center px-2">
{snap.isSearching ? (
<Input
+ ref={searchInputRef}
size="tiny"
autoFocus
className="w-52"
@@ -531,13 +560,19 @@ export const FileExplorerHeader = ({
onChange={(event) => setItemSearchString(event.target.value)}
/>
) : (
- <Button
- icon={<Search />}
- size="tiny"
- type="text"
- className="px-1"
- onClick={toggleSearch}
- />
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.LIST_PAGE_FOCUS_SEARCH}
+ label="Search files"
+ side="bottom"
+ >
+ <Button
+ icon={<Search />}
+ size="tiny"
+ type="text"
+ className="px-1"
+ onClick={toggleSearch}
+ />
+ </ShortcutTooltip>
)}
</div>
</div>
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeaderSelection.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeaderSelection.tsx
index 9b6cb895edf..9663749b997 100644
--- a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeaderSelection.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeaderSelection.tsx
@@ -3,7 +3,9 @@ import { Download, Move, Trash2, X } from 'lucide-react'
import { Button } from 'ui'
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'
import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
import { useStorageExplorerStateSnapshot } from '@/state/storage-explorer'
export const FileExplorerHeaderSelection = () => {
@@ -30,50 +32,66 @@ export const FileExplorerHeaderSelection = () => {
<span style={{ fontVariantNumeric: 'tabular-nums' }}>{selectedItems.length}</span> items
selected
</p>
- <Button
- icon={<Download size={16} strokeWidth={2} />}
- type="primary"
- onClick={async () => {
- if (selectedItems.length === 1) {
- await downloadFile(selectedItems[0])
- } else {
- await downloadSelectedFiles(selectedItems)
- }
- }}
- >
- Download
- </Button>
+ <ShortcutTooltip shortcutId={SHORTCUT_IDS.STORAGE_EXPLORER_DOWNLOAD_SELECTED} side="bottom">
+ <Button
+ icon={<Download size={16} strokeWidth={2} />}
+ type="primary"
+ onClick={async () => {
+ if (selectedItems.length === 1) {
+ await downloadFile(selectedItems[0])
+ } else {
+ await downloadSelectedFiles(selectedItems)
+ }
+ }}
+ >
+ Download
+ </Button>
+ </ShortcutTooltip>
<div className="border-r border-green-900 py-3 opacity-50" />
- <ButtonTooltip
- icon={<Trash2 size={16} strokeWidth={2} />}
- type="primary"
- disabled={!canUpdateFiles}
- onClick={() => setSelectedItemsToDelete(selectedItems)}
- tooltip={{
- content: {
- side: 'bottom',
- text: !canUpdateFiles ? 'You need additional permissions to delete files' : undefined,
- },
- }}
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.STORAGE_EXPLORER_DELETE_SELECTED}
+ side="bottom"
+ open={!canUpdateFiles ? false : undefined}
>
- Delete
- </ButtonTooltip>
+ <ButtonTooltip
+ icon={<Trash2 size={16} strokeWidth={2} />}
+ type="primary"
+ disabled={!canUpdateFiles}
+ onClick={() => setSelectedItemsToDelete(selectedItems)}
+ tooltip={{
+ content: {
+ side: 'bottom',
+ text: !canUpdateFiles
+ ? 'You need additional permissions to delete files'
+ : undefined,
+ },
+ }}
+ >
+ Delete
+ </ButtonTooltip>
+ </ShortcutTooltip>
- <ButtonTooltip
- icon={<Move size={16} strokeWidth={2} />}
- type="primary"
- disabled={!canUpdateFiles}
- onClick={() => setSelectedItemsToMove(selectedItems)}
- tooltip={{
- content: {
- side: 'bottom',
- text: !canUpdateFiles ? 'You need additional permissions to move files' : undefined,
- },
- }}
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.STORAGE_EXPLORER_MOVE_SELECTED}
+ side="bottom"
+ open={!canUpdateFiles ? false : undefined}
>
- Move
- </ButtonTooltip>
+ <ButtonTooltip
+ icon={<Move size={16} strokeWidth={2} />}
+ type="primary"
+ disabled={!canUpdateFiles}
+ onClick={() => setSelectedItemsToMove(selectedItems)}
+ tooltip={{
+ content: {
+ side: 'bottom',
+ text: !canUpdateFiles ? 'You need additional permissions to move files' : undefined,
+ },
+ }}
+ >
+ Move
+ </ButtonTooltip>
+ </ShortcutTooltip>
</div>
</div>
)
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/StorageExplorer.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/StorageExplorer.tsx
index 136e2181540..b1d4197234a 100644
--- a/apps/studio/components/interfaces/Storage/StorageExplorer/StorageExplorer.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/StorageExplorer.tsx
@@ -1,7 +1,7 @@
import { useDebounce } from '@uidotdev/usehooks'
import { useParams } from 'common'
import { compact, get, isEmpty, uniqBy } from 'lodash'
-import { useEffect, useRef, useState } from 'react'
+import { useCallback, useEffect, useRef, useState } from 'react'
import { useSelectedBucket } from '../FilesBuckets/useSelectedBucket'
import { STORAGE_ROW_TYPES, STORAGE_VIEWS } from '../Storage.constants'
@@ -12,6 +12,7 @@ import { FileExplorerHeader } from './FileExplorerHeader'
import { FileExplorerHeaderSelection } from './FileExplorerHeaderSelection'
import { MoveItemsModal } from './MoveItemsModal'
import { PreviewPane } from './PreviewPane'
+import { useStorageExplorerShortcuts } from './useStorageExplorerShortcuts'
import { useStoragePreference } from './useStoragePreference'
import { useProjectStorageConfigQuery } from '@/data/config/project-storage-config-query'
import type { Bucket } from '@/data/storage/buckets-query'
@@ -40,6 +41,7 @@ export const StorageExplorer = () => {
clearSelectedItems,
setSelectedFilePreview,
setSelectedItemsToMove,
+ setIsSearching,
} = useStorageExplorerStateSnapshot()
const { view } = useStoragePreference(projectRef)
@@ -55,6 +57,13 @@ export const StorageExplorer = () => {
const [itemSearchString, setItemSearchString] = useState('')
const debouncedSearchString = useDebounce(itemSearchString, 500)
+ const handleClearSearch = useCallback(() => {
+ setIsSearching(false)
+ setItemSearchString('')
+ }, [setIsSearching])
+
+ useStorageExplorerShortcuts({ onClearSearch: handleClearSearch })
+
const fetchContents = useStaticEffectEvent(async (bucket: Bucket) => {
if (view === STORAGE_VIEWS.LIST) {
const currentFolderIdx = openedFolders.length - 1
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/useFileExplorerHeaderShortcuts.ts b/apps/studio/components/interfaces/Storage/StorageExplorer/useFileExplorerHeaderShortcuts.ts
new file mode 100644
index 00000000000..4efd962b629
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/useFileExplorerHeaderShortcuts.ts
@@ -0,0 +1,50 @@
+import { RefObject } from 'react'
+
+import { STORAGE_VIEWS } from '../Storage.constants'
+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
+import { useShortcut } from '@/state/shortcuts/useShortcut'
+
+interface UseFileExplorerHeaderShortcutsParams {
+ uploadButtonRef: RefObject<HTMLInputElement>
+ searchInputRef: RefObject<HTMLInputElement>
+ canUpdateStorage: boolean
+ hasBreadcrumbs: boolean
+ isSearching: boolean
+ setIsSearching: (value: boolean) => void
+ addNewFolderPlaceholder: (columnIndex: number) => void
+ setView: (view: STORAGE_VIEWS) => void
+}
+
+export function useFileExplorerHeaderShortcuts({
+ uploadButtonRef,
+ searchInputRef,
+ canUpdateStorage,
+ hasBreadcrumbs,
+ isSearching,
+ setIsSearching,
+ addNewFolderPlaceholder,
+ setView,
+}: UseFileExplorerHeaderShortcutsParams) {
+ useShortcut(
+ SHORTCUT_IDS.LIST_PAGE_FOCUS_SEARCH,
+ () => {
+ if (!isSearching) setIsSearching(true)
+ requestAnimationFrame(() => {
+ searchInputRef.current?.focus()
+ searchInputRef.current?.select()
+ })
+ },
+ { label: 'Search files' }
+ )
+
+ useShortcut(SHORTCUT_IDS.STORAGE_EXPLORER_UPLOAD, () => uploadButtonRef.current?.click(), {
+ enabled: canUpdateStorage && hasBreadcrumbs,
+ })
+
+ useShortcut(SHORTCUT_IDS.STORAGE_EXPLORER_NEW_FOLDER, () => addNewFolderPlaceholder(-1), {
+ enabled: canUpdateStorage && hasBreadcrumbs,
+ })
+
+ useShortcut(SHORTCUT_IDS.STORAGE_EXPLORER_VIEW_COLUMNS, () => setView(STORAGE_VIEWS.COLUMNS))
+ useShortcut(SHORTCUT_IDS.STORAGE_EXPLORER_VIEW_LIST, () => setView(STORAGE_VIEWS.LIST))
+}
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/useStorageExplorerShortcuts.ts b/apps/studio/components/interfaces/Storage/StorageExplorer/useStorageExplorerShortcuts.ts
new file mode 100644
index 00000000000..804c70a7bb6
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/useStorageExplorerShortcuts.ts
@@ -0,0 +1,82 @@
+import { PermissionAction } from '@supabase/shared-types/out/constants'
+
+import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
+import { useShortcut } from '@/state/shortcuts/useShortcut'
+import { useStorageExplorerStateSnapshot } from '@/state/storage-explorer'
+
+interface UseStorageExplorerShortcutsParams {
+ onClearSearch: () => void
+}
+
+/**
+ * Shortcuts mounted in the stable StorageExplorer parent — they remain active
+ * regardless of whether the default header or the selection header is rendered.
+ *
+ * Handles refresh, multi-select actions (download, move, delete), and the
+ * Escape ladder (selection → preview → search).
+ */
+export function useStorageExplorerShortcuts({ onClearSearch }: UseStorageExplorerShortcutsParams) {
+ const {
+ selectedItems,
+ selectedFilePreview,
+ isSearching,
+ clearSelectedItems,
+ setSelectedItemsToDelete,
+ setSelectedItemsToMove,
+ setSelectedFilePreview,
+ downloadFile,
+ downloadSelectedFiles,
+ refreshAll,
+ } = useStorageExplorerStateSnapshot()
+
+ const { can: canUpdateFiles } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*')
+
+ useShortcut(
+ SHORTCUT_IDS.STORAGE_EXPLORER_REFRESH,
+ () => {
+ refreshAll()
+ },
+ { enabled: selectedItems.length === 0 }
+ )
+
+ useShortcut(
+ SHORTCUT_IDS.STORAGE_EXPLORER_DOWNLOAD_SELECTED,
+ () => {
+ if (selectedItems.length === 1) {
+ downloadFile(selectedItems[0])
+ } else {
+ downloadSelectedFiles(selectedItems)
+ }
+ },
+ { enabled: selectedItems.length > 0 }
+ )
+
+ useShortcut(
+ SHORTCUT_IDS.STORAGE_EXPLORER_MOVE_SELECTED,
+ () => setSelectedItemsToMove(selectedItems),
+ { enabled: selectedItems.length > 0 && canUpdateFiles }
+ )
+
+ useShortcut(
+ SHORTCUT_IDS.STORAGE_EXPLORER_DELETE_SELECTED,
+ () => setSelectedItemsToDelete(selectedItems),
+ { enabled: selectedItems.length > 0 }
+ )
+
+ useShortcut(SHORTCUT_IDS.STORAGE_EXPLORER_EXIT_SELECTION, () => clearSelectedItems(), {
+ enabled: selectedItems.length > 0,
+ })
+
+ useShortcut(
+ SHORTCUT_IDS.STORAGE_EXPLORER_CLOSE_PREVIEW,
+ () => setSelectedFilePreview(undefined),
+ {
+ enabled: selectedItems.length === 0 && !!selectedFilePreview,
+ }
+ )
+
+ useShortcut(SHORTCUT_IDS.STORAGE_EXPLORER_CLOSE_SEARCH, onClearSearch, {
+ enabled: selectedItems.length === 0 && !selectedFilePreview && isSearching,
+ })
+}
diff --git a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
index 510d0702790..9ea0cbe55e5 100644
--- a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
@@ -1,16 +1,27 @@
import { IS_PLATFORM, useParams } from 'common'
import Link from 'next/link'
+import { useRouter } from 'next/router'
import { Badge, Menu } from 'ui'
import { BUCKET_TYPES } from './Storage.constants'
import { useStorageV2Page } from './Storage.utils'
+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'
import {
useIsAnalyticsBucketsEnabled,
useIsVectorBucketsEnabled,
} from '@/data/config/project-storage-config-query'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
+import { SHORTCUT_IDS, type ShortcutId } from '@/state/shortcuts/registry'
+import { useShortcut } from '@/state/shortcuts/useShortcut'
+
+const BUCKET_TYPE_SHORTCUTS: Record<keyof typeof BUCKET_TYPES, ShortcutId> = {
+ files: SHORTCUT_IDS.NAV_STORAGE_FILES,
+ analytics: SHORTCUT_IDS.NAV_STORAGE_ANALYTICS,
+ vectors: SHORTCUT_IDS.NAV_STORAGE_VECTORS,
+}
export const StorageMenuV2 = () => {
+ const router = useRouter()
const { ref } = useParams()
const page = useStorageV2Page()
@@ -22,9 +33,27 @@ export const StorageMenuV2 = () => {
const isAnalyticsBucketsEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref })
const isVectorBucketsEnabled = useIsVectorBucketsEnabled({ projectRef: ref })
+ const showAnalytics = IS_PLATFORM && storageAnalytics
+ const showVectors = IS_PLATFORM && storageVectors
+
+ useShortcut(SHORTCUT_IDS.NAV_STORAGE_FILES, () => router.push(`/project/${ref}/storage/files`))
+ useShortcut(
+ SHORTCUT_IDS.NAV_STORAGE_ANALYTICS,
+ () => router.push(`/project/${ref}/storage/analytics`),
+ { enabled: showAnalytics }
+ )
+ useShortcut(
+ SHORTCUT_IDS.NAV_STORAGE_VECTORS,
+ () => router.push(`/project/${ref}/storage/vectors`),
+ { enabled: showVectors }
+ )
+ useShortcut(SHORTCUT_IDS.NAV_STORAGE_S3, () => router.push(`/project/${ref}/storage/s3`), {
+ enabled: IS_PLATFORM,
+ })
+
const bucketTypes = Object.entries(BUCKET_TYPES).filter(([key]) => {
- if (key === 'analytics') return IS_PLATFORM && storageAnalytics
- if (key === 'vectors') return IS_PLATFORM && storageVectors
+ if (key === 'analytics') return showAnalytics
+ if (key === 'vectors') return showVectors
return true
})
@@ -39,9 +68,10 @@ export const StorageMenuV2 = () => {
const isAlphaEnabled =
(type === 'analytics' && isAnalyticsBucketsEnabled) ||
(type === 'vectors' && isVectorBucketsEnabled)
+ const shortcutId = BUCKET_TYPE_SHORTCUTS[type as keyof typeof BUCKET_TYPES]
- return (
- <Link key={type} href={`/project/${ref}/storage/${type}`}>
+ const item = (
+ <Link href={`/project/${ref}/storage/${type}`}>
<Menu.Item rounded active={isSelected}>
<div className="flex items-center justify-between">
<p className="truncate">{config.displayName}</p>
@@ -50,6 +80,18 @@ export const StorageMenuV2 = () => {
</Menu.Item>
</Link>
)
+
+ return (
+ <div key={type}>
+ {shortcutId ? (
+ <ShortcutTooltip shortcutId={shortcutId} side="right" delayDuration={1000}>
+ {item}
+ </ShortcutTooltip>
+ ) : (
+ item
+ )}
+ </div>
+ )
})}
</div>
@@ -59,11 +101,17 @@ export const StorageMenuV2 = () => {
<div className="md:mx-3">
<Menu.Group title={<span className="uppercase font-mono">Configuration</span>} />
- <Link href={`/project/${ref}/storage/s3`}>
- <Menu.Item rounded active={page === 's3'}>
- <p className="truncate">S3</p>
- </Menu.Item>
- </Link>
+ <ShortcutTooltip
+ shortcutId={SHORTCUT_IDS.NAV_STORAGE_S3}
+ side="right"
+ delayDuration={1000}
+ >
+ <Link href={`/project/${ref}/storage/s3`}>
+ <Menu.Item rounded active={page === 's3'}>
+ <p className="truncate">S3</p>
+ </Menu.Item>
+ </Link>
+ </ShortcutTooltip>
</div>
</>
)}
diff --git a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsx b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsx
index 3668f8727ca..43899c02fea 100644
--- a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsx
+++ b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsx
@@ -37,6 +37,14 @@ const ACTIVE_AUTH_SHORTCUT_IDS = [
SHORTCUT_IDS.NAV_AUTH_USERS,
] satisfies ShortcutId[]
+const ACTIVE_SURFACE_SHORTCUT_IDS = [
+ ...ACTIVE_SHORTCUT_IDS,
+ SHORTCUT_IDS.AUTH_USERS_REFRESH,
+ SHORTCUT_IDS.SQL_EDITOR_FORMAT,
+ SHORTCUT_IDS.STORAGE_BUCKETS_REFRESH,
+ SHORTCUT_IDS.STORAGE_EXPLORER_REFRESH,
+] satisfies ShortcutId[]
+
let sequenceIdCounter = 0
const buildSequenceRegistration = (id: ShortcutId): SequenceRegistrationView => {
@@ -142,6 +150,19 @@ describe('ShortcutsReferenceSheet', () => {
expect(screen.getByText('Go to Users')).toBeInTheDocument()
})
+ it('uses human labels for active surface shortcut groups', async () => {
+ renderShortcutsReferenceSheet(ACTIVE_SURFACE_SHORTCUT_IDS)
+
+ expect(await screen.findByText('Auth Users')).toBeInTheDocument()
+ expect(screen.getByText('SQL Editor')).toBeInTheDocument()
+ expect(screen.getByText('Storage Buckets')).toBeInTheDocument()
+ expect(screen.getByText('Storage File Explorer')).toBeInTheDocument()
+ expect(screen.queryByText('auth-users')).not.toBeInTheDocument()
+ expect(screen.queryByText('sql-editor')).not.toBeInTheDocument()
+ expect(screen.queryByText('storage-buckets')).not.toBeInTheDocument()
+ expect(screen.queryByText('storage-explorer')).not.toBeInTheDocument()
+ })
+
it('does not show inactive database shortcuts in search results', async () => {
const user = userEvent.setup()
diff --git a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx
index 3eb2dbffe20..b8c6fb4b48c 100644
--- a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx
+++ b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx
@@ -43,6 +43,7 @@ const GROUP_LABELS: Record<string, string> = {
...SHORTCUT_REFERENCE_GROUP_LABELS,
'action-bar': 'Actions',
'ai-assistant': 'AI Assistant',
+ 'auth-users': 'Auth Users',
'command-menu': 'Command Menu',
'data-table': 'Data Tables',
'inline-editor': 'Inline Editor',
@@ -52,6 +53,9 @@ const GROUP_LABELS: Record<string, string> = {
results: 'Results',
'schema-visualizer': 'Schema Visualizer',
shortcuts: 'Shortcuts',
+ 'sql-editor': 'SQL Editor',
+ 'storage-buckets': 'Storage Buckets',
+ 'storage-explorer': 'Storage File Explorer',
'table-editor': 'Table Editor',
'unified-logs': 'Logs',
}
diff --git a/apps/studio/state/shortcuts/referenceGroups.ts b/apps/studio/state/shortcuts/referenceGroups.ts
index 82a6670c17e..4ffcd5f4a59 100644
--- a/apps/studio/state/shortcuts/referenceGroups.ts
+++ b/apps/studio/state/shortcuts/referenceGroups.ts
@@ -2,12 +2,14 @@ export const SHORTCUT_REFERENCE_GROUPS = {
NAVIGATION_GLOBAL: 'navigation.global',
NAVIGATION_DATABASE: 'navigation.database',
NAVIGATION_AUTH: 'navigation.auth',
+ NAVIGATION_STORAGE: 'navigation.storage',
} as const
export const SHORTCUT_REFERENCE_GROUP_LABELS: Record<string, string> = {
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL]: 'Global Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE]: 'Database Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_AUTH]: 'Auth Navigation',
+ [SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE]: 'Storage Navigation',
}
export const SHORTCUT_REFERENCE_GROUP_ORDER = [
@@ -16,9 +18,14 @@ export const SHORTCUT_REFERENCE_GROUP_ORDER = [
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_AUTH,
+ 'auth-users',
+ SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE,
+ 'storage-buckets',
+ 'storage-explorer',
'nav',
'ai-assistant',
'inline-editor',
+ 'sql-editor',
'results',
'data-table',
'table-editor',
diff --git a/apps/studio/state/shortcuts/registry.ts b/apps/studio/state/shortcuts/registry.ts
index fbec3caaf84..eb7d441fb5d 100644
--- a/apps/studio/state/shortcuts/registry.ts
+++ b/apps/studio/state/shortcuts/registry.ts
@@ -8,6 +8,9 @@ import {
schemaVisualizerRegistry,
} from './registry/schema-visualizer'
import { SQL_EDITOR_SHORTCUT_IDS, sqlEditorRegistry } from './registry/sql-editor'
+import { STORAGE_BUCKETS_SHORTCUT_IDS, storageBucketsRegistry } from './registry/storage-buckets'
+import { STORAGE_EXPLORER_SHORTCUT_IDS, storageExplorerRegistry } from './registry/storage-explorer'
+import { STORAGE_NAV_SHORTCUT_IDS, storageNavRegistry } from './registry/storage-nav'
import { TABLE_EDITOR_SHORTCUT_IDS, tableEditorRegistry } from './registry/table-editor'
import { ShortcutDefinition } from './types'
@@ -76,6 +79,13 @@ export const SHORTCUT_IDS = {
...AUTH_USERS_SHORTCUT_IDS,
// Auth sub-page navigation chords
...AUTH_NAV_SHORTCUT_IDS,
+
+ // Storage sub-page navigation chords
+ ...STORAGE_NAV_SHORTCUT_IDS,
+ // Storage Files (bucket list) page shortcuts
+ ...STORAGE_BUCKETS_SHORTCUT_IDS,
+ // Storage Explorer (file browser) shortcuts
+ ...STORAGE_EXPLORER_SHORTCUT_IDS,
} as const
/**
@@ -360,4 +370,11 @@ export const SHORTCUT_DEFINITIONS: Record<ShortcutId, ShortcutDefinition> = {
...authUsersRegistry,
// Auth sub-page navigation chord registration
...authNavRegistry,
+
+ // Storage sub-page navigation chord registration
+ ...storageNavRegistry,
+ // Storage Files (bucket list) page shortcut registration
+ ...storageBucketsRegistry,
+ // Storage Explorer (file browser) shortcut registration
+ ...storageExplorerRegistry,
}
diff --git a/apps/studio/state/shortcuts/registry/auth-users.ts b/apps/studio/state/shortcuts/registry/auth-users.ts
index 9bcae02edbd..e5738bfdb80 100644
--- a/apps/studio/state/shortcuts/registry/auth-users.ts
+++ b/apps/studio/state/shortcuts/registry/auth-users.ts
@@ -50,14 +50,14 @@ export const authUsersRegistry: RegistryDefinations<AuthUsersShortcutId> = {
label: 'Clear user selection',
sequence: ['Escape'],
showInSettings: false,
- options: { ignoreInputs: true },
+ options: { ignoreInputs: true, conflictBehavior: 'allow' },
},
[AUTH_USERS_SHORTCUT_IDS.AUTH_USERS_CLOSE_PANEL]: {
id: AUTH_USERS_SHORTCUT_IDS.AUTH_USERS_CLOSE_PANEL,
label: 'Close user details panel',
sequence: ['Escape'],
showInSettings: false,
- options: { ignoreInputs: true },
+ options: { ignoreInputs: true, conflictBehavior: 'allow' },
},
[AUTH_USERS_SHORTCUT_IDS.AUTH_USERS_START_NAV_DOWN]: {
id: AUTH_USERS_SHORTCUT_IDS.AUTH_USERS_START_NAV_DOWN,
diff --git a/apps/studio/state/shortcuts/registry/storage-buckets.ts b/apps/studio/state/shortcuts/registry/storage-buckets.ts
new file mode 100644
index 00000000000..6796740a40d
--- /dev/null
+++ b/apps/studio/state/shortcuts/registry/storage-buckets.ts
@@ -0,0 +1,32 @@
+import { RegistryDefinations } from '../types'
+
+/**
+ * Shortcuts scoped to the Storage Files (bucket list) page.
+ *
+ * The shared list-page shortcuts (focus search, create new item) are reused
+ * directly from `list-page.ts`. Only bucket-specific actions live here.
+ */
+export const STORAGE_BUCKETS_SHORTCUT_IDS = {
+ STORAGE_BUCKETS_REFRESH: 'storage-buckets.refresh',
+ STORAGE_BUCKETS_CLEAR_SORT: 'storage-buckets.clear-sort',
+}
+
+export type StorageBucketsShortcutId =
+ (typeof STORAGE_BUCKETS_SHORTCUT_IDS)[keyof typeof STORAGE_BUCKETS_SHORTCUT_IDS]
+
+export const storageBucketsRegistry: RegistryDefinations<StorageBucketsShortcutId> = {
+ [STORAGE_BUCKETS_SHORTCUT_IDS.STORAGE_BUCKETS_REFRESH]: {
+ id: STORAGE_BUCKETS_SHORTCUT_IDS.STORAGE_BUCKETS_REFRESH,
+ label: 'Refresh buckets',
+ sequence: ['Shift+R'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_BUCKETS_SHORTCUT_IDS.STORAGE_BUCKETS_CLEAR_SORT]: {
+ id: STORAGE_BUCKETS_SHORTCUT_IDS.STORAGE_BUCKETS_CLEAR_SORT,
+ label: 'Reset bucket sort',
+ sequence: ['S', 'C'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+}
diff --git a/apps/studio/state/shortcuts/registry/storage-explorer.ts b/apps/studio/state/shortcuts/registry/storage-explorer.ts
new file mode 100644
index 00000000000..b45655b6339
--- /dev/null
+++ b/apps/studio/state/shortcuts/registry/storage-explorer.ts
@@ -0,0 +1,104 @@
+import { RegistryDefinations } from '../types'
+
+/**
+ * Shortcuts scoped to the Storage Explorer (file browser inside a bucket).
+ *
+ * `Shift+F` (focus search) is provided by the shared `LIST_PAGE_FOCUS_SEARCH`
+ * shortcut and reused here via a contextual `label` override.
+ */
+export const STORAGE_EXPLORER_SHORTCUT_IDS = {
+ STORAGE_EXPLORER_REFRESH: 'storage-explorer.refresh',
+ STORAGE_EXPLORER_UPLOAD: 'storage-explorer.upload',
+ STORAGE_EXPLORER_NEW_FOLDER: 'storage-explorer.new-folder',
+ STORAGE_EXPLORER_VIEW_COLUMNS: 'storage-explorer.view-columns',
+ STORAGE_EXPLORER_VIEW_LIST: 'storage-explorer.view-list',
+ STORAGE_EXPLORER_DOWNLOAD_SELECTED: 'storage-explorer.download-selected',
+ STORAGE_EXPLORER_MOVE_SELECTED: 'storage-explorer.move-selected',
+ STORAGE_EXPLORER_DELETE_SELECTED: 'storage-explorer.delete-selected',
+ STORAGE_EXPLORER_EXIT_SELECTION: 'storage-explorer.exit-selection',
+ STORAGE_EXPLORER_CLOSE_PREVIEW: 'storage-explorer.close-preview',
+ STORAGE_EXPLORER_CLOSE_SEARCH: 'storage-explorer.close-search',
+}
+
+export type StorageExplorerShortcutId =
+ (typeof STORAGE_EXPLORER_SHORTCUT_IDS)[keyof typeof STORAGE_EXPLORER_SHORTCUT_IDS]
+
+export const storageExplorerRegistry: RegistryDefinations<StorageExplorerShortcutId> = {
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_REFRESH]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_REFRESH,
+ label: 'Refresh',
+ sequence: ['Shift+R'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_UPLOAD]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_UPLOAD,
+ label: 'Upload files',
+ sequence: ['I', 'F'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_NEW_FOLDER]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_NEW_FOLDER,
+ label: 'Create folder',
+ sequence: ['I', 'N'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_VIEW_COLUMNS]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_VIEW_COLUMNS,
+ label: 'View as columns',
+ sequence: ['V', 'C'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_VIEW_LIST]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_VIEW_LIST,
+ label: 'View as list',
+ sequence: ['V', 'L'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_DOWNLOAD_SELECTED]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_DOWNLOAD_SELECTED,
+ label: 'Download selected items',
+ sequence: ['Shift+D'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_MOVE_SELECTED]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_MOVE_SELECTED,
+ label: 'Move selected items',
+ sequence: ['Shift+M'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_DELETE_SELECTED]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_DELETE_SELECTED,
+ label: 'Delete selected items',
+ sequence: ['Mod+Backspace'],
+ showInSettings: false,
+ options: { ignoreInputs: true, registerInCommandMenu: true },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_EXIT_SELECTION]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_EXIT_SELECTION,
+ label: 'Clear item selection',
+ sequence: ['Escape'],
+ showInSettings: false,
+ options: { conflictBehavior: 'allow' },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_CLOSE_PREVIEW]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_CLOSE_PREVIEW,
+ label: 'Close file preview',
+ sequence: ['Escape'],
+ showInSettings: false,
+ options: { conflictBehavior: 'allow' },
+ },
+ [STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_CLOSE_SEARCH]: {
+ id: STORAGE_EXPLORER_SHORTCUT_IDS.STORAGE_EXPLORER_CLOSE_SEARCH,
+ label: 'Close search',
+ sequence: ['Escape'],
+ showInSettings: false,
+ options: { conflictBehavior: 'allow' },
+ },
+}
diff --git a/apps/studio/state/shortcuts/registry/storage-nav.ts b/apps/studio/state/shortcuts/registry/storage-nav.ts
new file mode 100644
index 00000000000..65015ab084c
--- /dev/null
+++ b/apps/studio/state/shortcuts/registry/storage-nav.ts
@@ -0,0 +1,50 @@
+import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'
+import { RegistryDefinations } from '../types'
+
+/**
+ * Contextual chords for jumping between Storage sub-pages — `S + <letter>`.
+ *
+ * Active only while StorageLayout is mounted (i.e. the user is somewhere under
+ * `/project/<ref>/storage/*`). Mirrors the database-nav / auth-nav pattern: the
+ * leading `S` is layout-scoped so it doesn't burn a global key.
+ */
+export const STORAGE_NAV_SHORTCUT_IDS = {
+ NAV_STORAGE_FILES: 'nav.storage-files',
+ NAV_STORAGE_ANALYTICS: 'nav.storage-analytics',
+ NAV_STORAGE_VECTORS: 'nav.storage-vectors',
+ NAV_STORAGE_S3: 'nav.storage-s3',
+}
+
+export type StorageNavShortcutId =
+ (typeof STORAGE_NAV_SHORTCUT_IDS)[keyof typeof STORAGE_NAV_SHORTCUT_IDS]
+
+export const storageNavRegistry: RegistryDefinations<StorageNavShortcutId> = {
+ [STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_FILES]: {
+ id: STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_FILES,
+ label: 'Go to Files',
+ sequence: ['S', 'F'],
+ showInSettings: false,
+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE,
+ },
+ [STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_ANALYTICS]: {
+ id: STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_ANALYTICS,
+ label: 'Go to Analytics buckets',
+ sequence: ['S', 'A'],
+ showInSettings: false,
+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE,
+ },
+ [STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_VECTORS]: {
+ id: STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_VECTORS,
+ label: 'Go to Vector buckets',
+ sequence: ['S', 'V'],
+ showInSettings: false,
+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE,
+ },
+ [STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_S3]: {
+ id: STORAGE_NAV_SHORTCUT_IDS.NAV_STORAGE_S3,
+ label: 'Go to S3 settings',
+ sequence: ['S', '3'],
+ showInSettings: false,
+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE,
+ },
+}
diff --git a/apps/studio/state/shortcuts/types.ts b/apps/studio/state/shortcuts/types.ts
index 1bed754b97f..0c5f0462604 100644
--- a/apps/studio/state/shortcuts/types.ts
+++ b/apps/studio/state/shortcuts/types.ts
@@ -65,6 +65,19 @@ export interface ShortcutOptions {
* registry default.
*/
label?: string
+
+ /**
+ * How the hotkey lib should behave when this shortcut's `sequence` is already
+ * registered by another mounted shortcut. Defaults to `'warn'` (the lib's
+ * default) — every duplicate registration logs a console warning.
+ *
+ * Set to `'allow'` for shortcuts that intentionally share a sequence with
+ * sibling shortcuts and are routed by mutually-exclusive `enabled` gates
+ * (e.g. an Escape ladder: clear selection → close preview → close search).
+ * Use `'replace'` only when you actually want the new registration to
+ * supplant the old one — rarely the right choice for our use cases.
+ */
+ conflictBehavior?: 'warn' | 'allow' | 'replace'
}
/**
diff --git a/apps/studio/state/shortcuts/useShortcut.tsx b/apps/studio/state/shortcuts/useShortcut.tsx
index 698c787425e..95a13308aa2 100644
--- a/apps/studio/state/shortcuts/useShortcut.tsx
+++ b/apps/studio/state/shortcuts/useShortcut.tsx
@@ -84,6 +84,7 @@ export function useShortcut(id: ShortcutId, callback: () => void, options?: Shor
const registerInCommandMenu =
options?.registerInCommandMenu ?? def.options?.registerInCommandMenu ?? false
const label = options?.label ?? def.label
+ const conflictBehavior = options?.conflictBehavior ?? def.options?.conflictBehavior
// Stable identity so we don't churn the registration store on every render.
// setOptions in @tanstack/hotkeys notifies subscribers each call, which
@@ -103,6 +104,7 @@ export function useShortcut(id: ShortcutId, callback: () => void, options?: Shor
timeout,
meta,
...(ignoreInputs !== undefined && { ignoreInputs }),
+ ...(conflictBehavior !== undefined && { conflictBehavior }),
})
// Handle overrides for command menu
diff --git a/apps/studio/state/storage-explorer.tsx b/apps/studio/state/storage-explorer.tsx
index 5d92010d29f..97e237bf014 100644
--- a/apps/studio/state/storage-explorer.tsx
+++ b/apps/studio/state/storage-explorer.tsx
@@ -165,6 +165,8 @@ function createStorageExplorerState({
isSearching: false,
setIsSearching: (value: boolean) => (state.isSearching = value),
+ isRefreshing: false,
+
selectedFilePreview: undefined as StorageItemWithColumn | undefined,
setSelectedFilePreview: (file?: StorageItemWithColumn) => (state.selectedFilePreview = file),
@@ -398,6 +400,15 @@ function createStorageExplorerState({
await state.fetchFoldersByPath({ paths })
},
+ refreshAll: async () => {
+ state.isRefreshing = true
+ try {
+ await state.refetchAllOpenedFolders()
+ } finally {
+ state.isRefreshing = false
+ }
+ },
+
fetchFoldersByPath: async ({
paths,
searchString = '',