Skip to content

Commit 05dec62

Browse files
authored
PivotGrid A11y and KBN - The headerfilter has an incorrect description in aria-label: there is no column name (#33736)
1 parent af63ebf commit 05dec62

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

e2e/testcafe-devextreme/tests/common/pivotGrid/fieldPanel/T1287521_fields_aria_label.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ test('Header fields should have correct aria-label', async (t) => {
2323
.expect(columnHeader.getHeaderFilterIcon(1).ariaLabel)
2424
.eql('Show filter options for column \'Column2\'')
2525
.expect(filterHeader.getHeaderFilterIcon(0).ariaLabel)
26-
.eql('Show filter options for column \'Column3\'');
26+
.eql('Show filter options for column \'Column3\'')
27+
.expect(columnHeader.getHeaderFilterIcon(2).ariaLabel)
28+
.notContains('undefined');
2729
}).before(async () => {
2830
await createWidget('dxPivotGrid', {
2931
allowFiltering: true,
@@ -43,6 +45,8 @@ test('Header fields should have correct aria-label', async (t) => {
4345
}, {
4446
dataField: 'column2',
4547
area: 'column',
48+
}, {
49+
area: 'column',
4650
}, {
4751
dataField: 'column3',
4852
area: 'filter',

packages/devextreme/js/__internal/grids/pivot_grid/field_chooser/m_field_chooser_base.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ export class FieldChooserBase extends mixinWidget {
173173

174174
renderField(field, showColumnLines) {
175175
const that = this;
176+
const caption = field.caption ?? field.dataField ?? '';
176177
const $fieldContent = $(DIV).addClass(CLASSES.area.fieldContent)
177-
.text(field.caption || field.dataField);
178+
.text(caption);
178179
const $fieldElement = $(DIV)
179180
.addClass(CLASSES.area.field)
180181
.addClass(CLASSES.area.box)
@@ -191,7 +192,7 @@ export class FieldChooserBase extends mixinWidget {
191192
alignment: that.option('rtlEnabled') ? 'right' : 'left',
192193
sortOrder: field.sortOrder === 'desc' ? 'desc' : 'asc',
193194
allowSorting: field.allowSorting,
194-
caption: field.caption || field.dataField,
195+
caption,
195196
},
196197
showColumnLines,
197198
});
@@ -205,7 +206,7 @@ export class FieldChooserBase extends mixinWidget {
205206
filterValues: mainGroupField.filterValues,
206207
allowFiltering: mainGroupField.allowFiltering && !field.groupIndex,
207208
allowSorting: field.allowSorting,
208-
caption: field.caption || field.dataField,
209+
caption,
209210
},
210211
showColumnLines,
211212
});

0 commit comments

Comments
 (0)