Skip to content

Commit 2725a37

Browse files
committed
Fixes AB#604, AB#605: editable table inputs not associated with table headers
1 parent 0d08c96 commit 2725a37

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/@batch-flask/ui/form/editable-table/editable-table.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ export class EditableTableComponent implements ControlValueAccessor, Validator,
120120
return index;
121121
}
122122

123+
public getHeaderIdForColumn(column: EditableTableColumnComponent) {
124+
return `table-header-${column.name}`
125+
}
126+
123127
private _buildControlsFromValue(items: any[], columns: EditableTableColumnComponent[]) {
124128
if (Array.isArray(items) && items.length > 0) {
125129
const controls: FormGroup[] = Object.values(this.items.controls).slice(0, items.length) as any;

src/@batch-flask/ui/form/editable-table/editable-table.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<table class="noselect" cellspacing="0" cellpadding="0" formArrayName="items" [attr.aria-label]="label" role="grid">
44
<thead>
55
<tr>
6-
<th *ngFor="let column of columns;trackBy: trackColumn">
6+
<th *ngFor="let column of columns;trackBy: trackColumn" [attr.id]="getHeaderIdForColumn(column)">
77
<ng-template [ngTemplateOutlet]="column.content"></ng-template>
88
</th>
99
<th class="action-column"></th>
@@ -18,7 +18,7 @@
1818
[rowValue]="item.value"></bl-editable-table-select-cell>
1919
</ng-container>
2020
<ng-container *ngSwitchDefault>
21-
<input [formControl]="item.controls[column.name]" [attr.type]="column.type" [attr.aria-placeholder]="column.name">
21+
<input [formControl]="item.controls[column.name]" [attr.type]="column.type" [attr.aria-describedby]="getHeaderIdForColumn(column)" [attr.aria-labeledby]="getHeaderIdForColumn(column)">
2222
</ng-container>
2323
</ng-container>
2424
</td>

0 commit comments

Comments
 (0)