Skip to content

Commit 41da767

Browse files
Merge branch '26_1' into 26_1_T1327666
2 parents 3c1dd1e + a800afd commit 41da767

2 files changed

Lines changed: 50 additions & 4 deletions

File tree

packages/devextreme/js/__internal/ui/list/list.edit.decorator.selection.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,20 @@ class EditDecoratorSelection extends EditDecorator {
162162
.addClass(SELECT_DECORATOR_SELECT_ALL_CHECKBOX_CLASS)
163163
.appendTo(this._$selectAll);
164164

165+
const { selectAllText = messageLocalization.format('dxList-selectAll') } = this._list.option();
166+
165167
this._selectAllCheckBox = this._list._createComponent(
166168
selectAllCheckBoxElement,
167169
CheckBox,
168170
{
169-
elementAttr: { 'aria-label': messageLocalization.format('dxList-selectAll') },
171+
elementAttr: { 'aria-label': selectAllText },
170172
focusStateEnabled: false,
171173
hoverStateEnabled: false,
172174
},
173175
);
174176

175177
this._selectAllCheckBox.registerKeyHandler('downArrow', downArrowHandler);
176178

177-
const { selectAllText = '' } = this._list.option();
178-
179179
$('<div>').addClass(SELECT_DECORATOR_SELECT_ALL_LABEL_CLASS)
180180
.text(selectAllText)
181181
.appendTo(this._$selectAll);
@@ -213,13 +213,14 @@ class EditDecoratorSelection extends EditDecorator {
213213
}
214214

215215
const { value } = this._selectAllCheckBox?.option() ?? {};
216+
const { selectAllText = messageLocalization.format('dxList-selectAll') } = this._list.option();
216217

217218
const indeterminate = value === undefined;
218219
const checkedState = value ? 'checked' : 'notChecked';
219220

220221
const stateVariableName = indeterminate ? 'indeterminate' : checkedState;
221222

222-
const label = `${messageLocalization.format('dxList-selectAll')}, ${messageLocalization.format(`dxList-selectAll-${stateVariableName}`)}`;
223+
const label = `${selectAllText}, ${messageLocalization.format(`dxList-selectAll-${stateVariableName}`)}`;
223224
// @ts-expect-error ts-error
224225
this._$selectAll.attr({ 'aria-label': label });
225226
}

packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5297,4 +5297,49 @@ QUnit.module('Accessibility', () => {
52975297
$groupHeader.trigger('dxclick');
52985298
assert.strictEqual($groupHeader.attr('aria-expanded'), 'true', 'aria-expanded is changed');
52995299
});
5300+
5301+
QUnit.test('SelectAll checkbox aria-label should reflect selectAllText option on init (T1328637)', function(assert) {
5302+
$('#list').dxList({
5303+
selectionMode: 'all',
5304+
showSelectionControls: true,
5305+
selectAllText: 'custom-select-all',
5306+
});
5307+
5308+
const $selectAllCheckBox = $(`.${LIST_SELECT_ALL_CHECKBOX_CLASS}`);
5309+
5310+
assert.strictEqual($selectAllCheckBox.attr('aria-label'), 'custom-select-all',
5311+
'checkbox aria-label uses selectAllText');
5312+
});
5313+
5314+
QUnit.test('Select all container aria-label should reflect selectAllText option on init (T1328637)', function(assert) {
5315+
$('#list').dxList({
5316+
selectionMode: 'all',
5317+
showSelectionControls: true,
5318+
selectAllText: 'custom-select-all',
5319+
});
5320+
5321+
const $selectAll = $(`.${LIST_SELECT_ALL_CLASS}`);
5322+
5323+
assert.strictEqual($selectAll.attr('aria-label'), 'custom-select-all, Not checked',
5324+
'container aria-label uses selectAllText');
5325+
});
5326+
5327+
QUnit.test('Select all aria-labels should update when selectAllText changes at runtime (T1328637)', function(assert) {
5328+
const instance = $('#list').dxList({
5329+
items: ['text 1'],
5330+
selectionMode: 'all',
5331+
showSelectionControls: true,
5332+
}).dxList('instance');
5333+
5334+
instance.option('selectAllText', 'custom-select-all');
5335+
5336+
const $selectAll = $(`.${LIST_SELECT_ALL_CLASS}`);
5337+
const $selectAllCheckBox = $(`.${LIST_SELECT_ALL_CHECKBOX_CLASS}`);
5338+
5339+
assert.strictEqual($selectAll.attr('aria-label'), 'custom-select-all, Not checked',
5340+
'container aria-label updated after runtime change');
5341+
assert.strictEqual($selectAllCheckBox.attr('aria-label'), 'custom-select-all',
5342+
'checkbox aria-label updated after runtime change');
5343+
});
5344+
53005345
});

0 commit comments

Comments
 (0)