@@ -1808,6 +1808,15 @@ export abstract class IgxGridBaseDirective implements GridType,
18081808 @HostBinding ( 'class.igx-grid' )
18091809 protected baseClass = 'igx-grid' ;
18101810
1811+ @HostBinding ( 'attr.aria-colcount' )
1812+ protected get ariaColCount ( ) : number {
1813+ return this . visibleColumns . length ;
1814+ }
1815+
1816+ @HostBinding ( 'attr.aria-rowcount' )
1817+ protected get ariaRowCount ( ) : number {
1818+ return this . _rendered ? this . _rowCount : null ;
1819+ }
18111820
18121821 /**
18131822 * Gets/Sets the resource strings.
@@ -2734,13 +2743,10 @@ export abstract class IgxGridBaseDirective implements GridType,
27342743 public get activeDescendant ( ) {
27352744 const activeElem = this . navigation . activeNode ;
27362745
2737- if ( ! activeElem || ! Object . keys ( activeElem ) . length ) {
2738- return this . id ;
2746+ if ( ! activeElem || ! Object . keys ( activeElem ) . length || activeElem . row < 0 ) {
2747+ return null ;
27392748 }
2740-
2741- return activeElem . row < 0 ?
2742- `${ this . id } _${ activeElem . row } _${ activeElem . mchCache . level } _${ activeElem . column } ` :
2743- `${ this . id } _${ activeElem . row } _${ activeElem . column } ` ;
2749+ return `${ this . id } _${ activeElem . row } _${ activeElem . column } ` ;
27442750 }
27452751
27462752 /** @hidden @internal */
@@ -3269,6 +3275,7 @@ export abstract class IgxGridBaseDirective implements GridType,
32693275 private _sortDescendingHeaderIconTemplate : TemplateRef < IgxGridHeaderTemplateContext > = null ;
32703276 private _gridSize : Size = Size . Large ;
32713277 private _defaultRowHeight = 50 ;
3278+ private _rowCount : number ;
32723279
32733280 /**
32743281 * @hidden @internal
@@ -4090,6 +4097,7 @@ export abstract class IgxGridBaseDirective implements GridType,
40904097 if ( this . hasColumnsToAutosize ) {
40914098 this . autoSizeColumnsInView ( ) ;
40924099 }
4100+ this . _calculateRowCount ( ) ;
40934101 this . _rendered = true ;
40944102 } ) ;
40954103 Promise . resolve ( ) . then ( ( ) => this . rendered . next ( true ) ) ;
@@ -6732,6 +6740,7 @@ export abstract class IgxGridBaseDirective implements GridType,
67326740
67336741 this . initColumns ( this . _columns , ( col : IgxColumnComponent ) => this . columnInit . emit ( col ) ) ;
67346742 this . columnListDiffer . diff ( this . columnList ) ;
6743+ this . _calculateRowCount ( ) ;
67356744
67366745 this . columnList . changes
67376746 . pipe ( takeUntil ( this . destroy$ ) )
@@ -7955,4 +7964,15 @@ export abstract class IgxGridBaseDirective implements GridType,
79557964 return recreateTreeFromFields ( value , this . _columns ) as IFilteringExpressionsTree ;
79567965 }
79577966 }
7967+
7968+ private _calculateRowCount ( ) : void {
7969+ if ( this . verticalScrollContainer ?. isRemote ) {
7970+ this . _rowCount = this . verticalScrollContainer . totalItemCount ?? 0 ;
7971+ } else if ( this . paginator ) {
7972+ this . _rowCount = this . totalRecords ?? 0 ;
7973+ } else {
7974+ this . _rowCount = this . verticalScrollContainer ?. igxForOf ?. length ?? 0 ;
7975+ }
7976+ this . _rowCount += 1 ; // include header row
7977+ }
79587978}
0 commit comments