@@ -1527,25 +1527,6 @@ export function TableGrid({
15271527 return
15281528 }
15291529
1530- if ( ( e . metaKey || e . ctrlKey ) && e . key === 'a' ) {
1531- e . preventDefault ( )
1532- const rws = rowsRef . current
1533- const currentCols = columnsRef . current
1534- if ( rws . length > 0 && currentCols . length > 0 ) {
1535- suppressFocusScrollRef . current = true
1536- setEditingCell ( null )
1537- setRowSelection ( ( prev ) => ( prev . kind === 'none' ? prev : ROW_SELECTION_NONE ) )
1538- lastCheckboxRowRef . current = null
1539- setSelectionAnchor ( { rowIndex : 0 , colIndex : 0 } )
1540- setSelectionFocus ( {
1541- rowIndex : rws . length - 1 ,
1542- colIndex : currentCols . length - 1 ,
1543- } )
1544- setIsColumnSelection ( false )
1545- }
1546- return
1547- }
1548-
15491530 if ( ( e . metaKey || e . ctrlKey ) && e . key === ' ' ) {
15501531 const a = selectionAnchorRef . current
15511532 if ( ! a || editingCellRef . current ) return
@@ -2281,6 +2262,33 @@ export function TableGrid({
22812262 }
22822263 } , [ ] )
22832264
2265+ useEffect ( ( ) => {
2266+ if ( embedded ) return
2267+ const handleSelectAll = ( e : KeyboardEvent ) => {
2268+ if ( ! ( e . metaKey || e . ctrlKey ) || e . key !== 'a' ) return
2269+ const target = e . target as HTMLElement
2270+ const tag = target . tagName
2271+ if ( tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' ) return
2272+ if ( target . isContentEditable ) return
2273+ if ( target . closest ( '[role="dialog"]' ) ) return
2274+ if ( ! containerRef . current ) return
2275+ e . preventDefault ( )
2276+ const rws = rowsRef . current
2277+ const currentCols = columnsRef . current
2278+ if ( rws . length > 0 && currentCols . length > 0 ) {
2279+ suppressFocusScrollRef . current = true
2280+ setEditingCell ( null )
2281+ setRowSelection ( ( prev ) => ( prev . kind === 'none' ? prev : ROW_SELECTION_NONE ) )
2282+ lastCheckboxRowRef . current = null
2283+ setSelectionAnchor ( { rowIndex : 0 , colIndex : 0 } )
2284+ setSelectionFocus ( { rowIndex : rws . length - 1 , colIndex : currentCols . length - 1 } )
2285+ setIsColumnSelection ( false )
2286+ }
2287+ }
2288+ document . addEventListener ( 'keydown' , handleSelectAll )
2289+ return ( ) => document . removeEventListener ( 'keydown' , handleSelectAll )
2290+ } , [ embedded ] )
2291+
22842292 const navigateAfterSave = useCallback ( ( reason : SaveReason ) => {
22852293 const anchor = selectionAnchorRef . current
22862294 if ( ! anchor ) return
0 commit comments