66 * found in the LICENSE file at https://angular.dev/license
77 */
88
9+ import { _getEventTarget } from '@angular/cdk/platform' ;
910import { SignalLike , computed , signal , untracked } from '../behaviors/signal-like/signal-like' ;
1011import { KeyboardEventManager , ClickEventManager , Modifier } from '../behaviors/event-manager' ;
1112import { NavOptions , Grid , GridInputs as GridBehaviorInputs } from '../behaviors/grid' ;
@@ -146,7 +147,7 @@ export class GridPattern {
146147 // Navigation without selection.
147148 if ( ! this . inputs . enableSelection ( ) ) {
148149 manager . on ( e => {
149- const cell = this . inputs . getCell ( e . target as Element ) ;
150+ const cell = this . inputs . getCell ( _getEventTarget ( e ) ) ;
150151 if ( ! cell || ! this . gridBehavior . focusBehavior . isFocusable ( cell ) ) return ;
151152
152153 this . gridBehavior . gotoCell ( cell ) ;
@@ -156,7 +157,7 @@ export class GridPattern {
156157 // Navigation with selection.
157158 if ( this . inputs . enableSelection ( ) ) {
158159 manager . on ( e => {
159- const cell = this . inputs . getCell ( e . target as Element ) ;
160+ const cell = this . inputs . getCell ( _getEventTarget ( e ) ) ;
160161 if ( ! cell || ! this . gridBehavior . focusBehavior . isFocusable ( cell ) ) return ;
161162
162163 this . gridBehavior . gotoCell ( cell , {
@@ -169,7 +170,7 @@ export class GridPattern {
169170 // Selection with modifier keys.
170171 if ( this . inputs . multi ( ) ) {
171172 manager . on ( [ Modifier . Ctrl , Modifier . Meta ] , e => {
172- const cell = this . inputs . getCell ( e . target as Element ) ;
173+ const cell = this . inputs . getCell ( _getEventTarget ( e ) ) ;
173174 if ( ! cell || ! this . gridBehavior . focusBehavior . isFocusable ( cell ) ) return ;
174175
175176 this . gridBehavior . gotoCell ( cell , { toggle : true } ) ;
@@ -233,7 +234,7 @@ export class GridPattern {
233234 this . hasBeenInteracted . set ( true ) ;
234235
235236 // Cell that receives focus.
236- const cell = this . inputs . getCell ( event . target as Element | null ) ;
237+ const cell = this . inputs . getCell ( _getEventTarget ( event ) ) ;
237238 if ( ! cell || ! this . gridBehavior . focusBehavior . isFocusable ( cell ) ) return ;
238239
239240 // Pass down the focusin event to the cell.
@@ -249,7 +250,7 @@ export class GridPattern {
249250 /** Handles focusout events on the grid. */
250251 onFocusOut ( event : FocusEvent ) {
251252 // Pass down focusout event to the cell that loses focus.
252- const blurTarget = event . target as Element | null ;
253+ const blurTarget = _getEventTarget < Element > ( event ) ;
253254 const cell = this . inputs . getCell ( blurTarget ) ;
254255
255256 // Pass down the focusout event to the cell.
0 commit comments