Skip to content

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

feat: add keyboard support to logs table (#33391)

Jordi Enricf697c86c864d
diff --git a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx
index a775c1ea7fa..45365becc5e 100644
--- a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx
+++ b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx
@@ -379,6 +379,32 @@ const LogTable = ({
}
}, [selectedLog, isSelectedLogLoading])
+ // Keyboard navigation
+ const handleKeyDown = useCallback(
+ (event: KeyboardEvent) => {
+ if (!logDataRows.length || !selectedRow) return
+
+ const currentIndex = logDataRows.findIndex((row) => isEqual(row, selectedRow))
+ if (currentIndex === -1) return
+
+ if (event.key === 'ArrowUp' && currentIndex > 0) {
+ const prevRow = logDataRows[currentIndex - 1]
+ onRowClick(prevRow)
+ } else if (event.key === 'ArrowDown' && currentIndex < logDataRows.length - 1) {
+ const nextRow = logDataRows[currentIndex + 1]
+ onRowClick(nextRow)
+ }
+ },
+ [logDataRows, selectedRow, onRowClick]
+ )
+
+ useEffect(() => {
+ window.addEventListener('keydown', handleKeyDown)
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown)
+ }
+ }, [handleKeyDown])
+
if (!data) return null
return (