@@ -131,7 +131,7 @@ export class IgxGridNavigationService {
131131 if ( this . isColumnLeftEdgeVisible ( visibleColumnIndex + 1 ) ) {
132132 element . nextElementSibling . firstElementChild . focus ( { preventScroll : true } ) ;
133133 } else {
134- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
134+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
135135 this . grid . parentVirtDir . onChunkLoad
136136 . pipe ( first ( ) )
137137 . subscribe ( ( ) => {
@@ -205,7 +205,7 @@ export class IgxGridNavigationService {
205205 if ( this . grid . pinnedColumns . length || this . displayContainerScrollLeft === 0 ) {
206206 firstCell . focus ( { preventScroll : true } ) ;
207207 } else {
208- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
208+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
209209 this . grid . parentVirtDir . onChunkLoad
210210 . pipe ( first ( ) )
211211 . subscribe ( ( ) => {
@@ -226,7 +226,7 @@ export class IgxGridNavigationService {
226226 const allCells = rowElement . querySelectorAll ( this . getCellSelector ( - 1 , isSummary ) ) ;
227227 allCells [ allCells . length - 1 ] . focus ( { preventScroll : true } ) ;
228228 } else {
229- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
229+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
230230 this . grid . parentVirtDir . onChunkLoad
231231 . pipe ( first ( ) )
232232 . subscribe ( ( ) => {
@@ -245,7 +245,7 @@ export class IgxGridNavigationService {
245245 `${ cellSelector } [data-visibleIndex="${ visibleColumnIndex } "]` ) ;
246246 cells [ 0 ] . focus ( ) ;
247247 } else {
248- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
248+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
249249 this . grid . verticalScrollContainer . scrollTo ( 0 ) ;
250250 this . grid . verticalScrollContainer . onChunkLoad
251251 . pipe ( first ( ) ) . subscribe ( ( ) => {
@@ -265,7 +265,7 @@ export class IgxGridNavigationService {
265265 `${ cellSelector } [data-visibleIndex="${ visibleColumnIndex } "]` ) ;
266266 cells [ cells . length - 1 ] . focus ( ) ;
267267 } else {
268- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
268+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
269269 this . grid . verticalScrollContainer . scrollTo ( this . grid . verticalScrollContainer . igxForOf . length - 1 ) ;
270270 this . grid . verticalScrollContainer . onChunkLoad
271271 . pipe ( first ( ) ) . subscribe ( ( ) => {
@@ -285,7 +285,7 @@ export class IgxGridNavigationService {
285285 const containerTopOffset = parseInt ( this . verticalDisplayContainerElement . style . top , 10 ) ;
286286 if ( ! rowElement . previousElementSibling ||
287287 rowElement . previousElementSibling . offsetTop < Math . abs ( containerTopOffset ) ) {
288- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
288+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
289289 this . grid . verticalScrollContainer . scrollTo ( currentRowIndex - 1 ) ;
290290 this . grid . verticalScrollContainer . onChunkLoad
291291 . pipe ( first ( ) )
@@ -322,7 +322,7 @@ export class IgxGridNavigationService {
322322 const targetEndTopOffset = rowElement . nextElementSibling ?
323323 rowElement . nextElementSibling . offsetTop + rowHeight + parseInt ( this . verticalDisplayContainerElement . style . top , 10 ) :
324324 containerHeight + rowHeight ;
325- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
325+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
326326 if ( containerHeight && containerHeight < targetEndTopOffset ) {
327327 const nextIndex = currentRowIndex + 1 ;
328328 this . grid . verticalScrollContainer . scrollTo ( nextIndex ) ;
@@ -366,7 +366,7 @@ export class IgxGridNavigationService {
366366 if ( ! horizontalScroll . clientWidth || parseInt ( horizontalScroll . scrollLeft , 10 ) <= 1 || this . grid . pinnedColumns . length ) {
367367 this . navigateTop ( 0 ) ;
368368 } else {
369- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
369+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
370370 this . horizontalScroll ( this . grid . dataRowList . first . index ) . scrollTo ( 0 ) ;
371371 this . grid . parentVirtDir . onChunkLoad
372372 . pipe ( first ( ) )
@@ -385,7 +385,7 @@ export class IgxGridNavigationService {
385385 const rowIndex = parseInt ( rows [ rows . length - 1 ] . getAttribute ( 'data-rowIndex' ) , 10 ) ;
386386 this . onKeydownEnd ( rowIndex ) ;
387387 } else {
388- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
388+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
389389 this . grid . verticalScrollContainer . scrollTo ( this . grid . verticalScrollContainer . igxForOf . length - 1 ) ;
390390 this . grid . verticalScrollContainer . onChunkLoad
391391 . pipe ( first ( ) ) . subscribe ( ( ) => {
@@ -598,7 +598,7 @@ export class IgxGridNavigationService {
598598 public performHorizontalScrollToCell (
599599 rowIndex : number , visibleColumnIndex : number , isSummary : boolean = false , cb ?: ( ) => void ) {
600600 const unpinnedIndex = this . getColumnUnpinnedIndex ( visibleColumnIndex ) ;
601- this . grid . nativeElement . focus ( { preventScroll : true } ) ;
601+ this . getFocusableGrid ( ) . nativeElement . focus ( { preventScroll : true } ) ;
602602 this . grid . parentVirtDir . onChunkLoad
603603 . pipe ( first ( ) )
604604 . subscribe ( ( ) => {
@@ -614,6 +614,10 @@ export class IgxGridNavigationService {
614614 this . horizontalScroll ( rowIndex ) . scrollTo ( unpinnedIndex ) ;
615615 }
616616
617+ protected getFocusableGrid ( ) {
618+ return this . grid ;
619+ }
620+
617621 protected getRowByIndex ( index , selector = this . getRowSelector ( ) ) {
618622 return this . grid . nativeElement . querySelector (
619623 `${ selector } [data-rowindex="${ index } "]` ) ;
0 commit comments