@@ -1044,6 +1044,103 @@ cdkPopoverEditTabOut`, fakeAsync(() => {
10441044 }
10451045} ) ;
10461046
1047+ @Component ( {
1048+ template : `
1049+ <div #table [dir]="direction">
1050+ <table cdk-table editable [dataSource]="dataSource" [multiTemplateDataRows]="true">
1051+ <ng-container cdkColumnDef="before">
1052+ <td cdk-cell *cdkCellDef="let element">
1053+ just a cell
1054+ </td>
1055+ </ng-container>
1056+
1057+ <ng-container cdkColumnDef="name">
1058+ <td cdk-cell *cdkCellDef="let element"
1059+ ${ POPOVER_EDIT_DIRECTIVE_NAME } >
1060+ ${ CELL_TEMPLATE }
1061+
1062+ <ng-template #nameEdit>
1063+ ${ NAME_EDIT_TEMPLATE }
1064+ </ng-template>
1065+
1066+ <span *cdkIfRowHovered>
1067+ <button cdkEditOpen>Edit</button>
1068+ </span>
1069+ </td>
1070+ </ng-container>
1071+
1072+ <ng-container cdkColumnDef="weight">
1073+ <td cdk-cell *cdkCellDef="let element"
1074+ ${ POPOVER_EDIT_DIRECTIVE_WEIGHT } >
1075+ {{element.weight}}
1076+
1077+ <ng-template #weightEdit>
1078+ ${ WEIGHT_EDIT_TEMPLATE }
1079+ </ng-template>
1080+ </td>
1081+ </ng-container>
1082+
1083+ <ng-container cdkColumnDef="skip">
1084+ <td cdk-cell *cdkCellDef="let element" colspan="3"></td>
1085+ </ng-container>
1086+
1087+ <tr cdk-row *cdkRowDef="let row; columns: displayedColumns;"></tr>
1088+ <tr cdk-row *cdkRowDef="let row; columns: ['skip'];"
1089+ class="cdk-popover-edit-skip-focus"></tr>
1090+ </table>
1091+ <div>
1092+ ` ,
1093+ standalone : false ,
1094+ } )
1095+ class CdkTableWithSkipRows extends BaseTestComponent {
1096+ displayedColumns = [ 'before' , 'name' , 'weight' ] ;
1097+ dataSource : ElementDataSource ;
1098+
1099+ renderData ( ) {
1100+ this . dataSource = new ElementDataSource ( ) ;
1101+ this . cdr . markForCheck ( ) ;
1102+ }
1103+ }
1104+
1105+ describe ( 'CDK Popover Edit - with focus ignore rows' , ( ) => {
1106+ let component : CdkTableWithSkipRows ;
1107+ let fixture : ComponentFixture < CdkTableWithSkipRows > ;
1108+
1109+ const dispatchKey = ( cell : HTMLElement , keyCode : number ) =>
1110+ dispatchKeyboardEvent ( cell , 'keydown' , keyCode ) ;
1111+
1112+ beforeEach ( fakeAsync ( ( ) => {
1113+ TestBed . configureTestingModule ( {
1114+ imports : [ CdkTableModule , CdkPopoverEditModule , FormsModule , BidiModule ] ,
1115+ declarations : [ CdkTableWithSkipRows ] ,
1116+ } ) ;
1117+ fixture = TestBed . createComponent ( CdkTableWithSkipRows ) ;
1118+ component = fixture . componentInstance ;
1119+ component . renderData ( ) ;
1120+ fixture . detectChanges ( ) ;
1121+ tick ( 10 ) ;
1122+ fixture . detectChanges ( ) ;
1123+ } ) ) ;
1124+
1125+ it ( 'skips ignored rows when moving focus up' , ( ) => {
1126+ const rows = component . getRows ( ) ;
1127+
1128+ getCells ( rows [ 4 ] ) [ 1 ] . focus ( ) ;
1129+
1130+ dispatchKey ( getCells ( rows [ 4 ] ) [ 1 ] , UP_ARROW ) ;
1131+ expect ( document . activeElement ) . toBe ( getCells ( rows [ 2 ] ) [ 1 ] ) ;
1132+ } ) ;
1133+
1134+ it ( 'skips ignored rows when moving focus down' , ( ) => {
1135+ const rows = component . getRows ( ) ;
1136+
1137+ getCells ( rows [ 0 ] ) [ 1 ] . focus ( ) ;
1138+
1139+ dispatchKey ( getCells ( rows [ 0 ] ) [ 1 ] , DOWN_ARROW ) ;
1140+ expect ( document . activeElement ) . toBe ( getCells ( rows [ 2 ] ) [ 1 ] ) ;
1141+ } ) ;
1142+ } ) ;
1143+
10471144interface ChemicalElement {
10481145 name : string ;
10491146 weight : number ;
0 commit comments