@@ -21,6 +21,9 @@ export interface GridInputs extends Omit<GridBehaviorInputs<GridCellPattern>, 'c
2121 /** The rows that make up the grid. */
2222 rows : SignalLike < GridRowPattern [ ] > ;
2323
24+ /** The direction that text is read based on the users locale. */
25+ textDirection : SignalLike < 'rtl' | 'ltr' > ;
26+ 2427 /** A function that returns the grid cell associated with a given element. */
2528 getCell : ( e : Element ) => GridCellPattern | undefined ;
2629}
@@ -59,6 +62,16 @@ export class GridPattern {
5962 /** Whether the user is currently dragging to select a range of cells. */
6063 readonly dragging = signal ( false ) ;
6164
65+ /** The key for navigating to the previous column. */
66+ readonly prevColKey = computed ( ( ) =>
67+ this . inputs . textDirection ( ) === 'rtl' ? 'ArrowRight' : 'ArrowLeft' ,
68+ ) ;
69+ 70+ /** The key for navigating to the next column. */
71+ readonly nextColKey = computed ( ( ) =>
72+ this . inputs . textDirection ( ) === 'rtl' ? 'ArrowLeft' : 'ArrowRight' ,
73+ ) ;
74+ 6275 /** The keydown event manager for the grid. */
6376 readonly keydown = computed ( ( ) => {
6477 const manager = new KeyboardEventManager ( ) ;
@@ -70,8 +83,8 @@ export class GridPattern {
7083 manager
7184 . on ( 'ArrowUp' , ( ) => this . gridBehavior . up ( ) )
7285 . on ( 'ArrowDown' , ( ) => this . gridBehavior . down ( ) )
73- . on ( 'ArrowLeft' , ( ) => this . gridBehavior . left ( ) )
74- . on ( 'ArrowRight' , ( ) => this . gridBehavior . right ( ) )
86+ . on ( this . prevColKey ( ) , ( ) => this . gridBehavior . left ( ) )
87+ . on ( this . nextColKey ( ) , ( ) => this . gridBehavior . right ( ) )
7588 . on ( 'Home' , ( ) => this . gridBehavior . firstInRow ( ) )
7689 . on ( 'End' , ( ) => this . gridBehavior . lastInRow ( ) )
7790 . on ( [ Modifier . Ctrl ] , 'Home' , ( ) => this . gridBehavior . first ( ) )
0 commit comments