Skip to content

Commit 139d7fb

Browse files
List should not display "[object Object]" in the aria-label attribute in multiple selection mode, especially when displayExpr and default text field are missed (T1285078) (DevExpress#29580)
1 parent 668646e commit 139d7fb

File tree

37 files changed

+60
-8
lines changed

37 files changed

+60
-8
lines changed

apps/demos/Demos/List/ItemTemplate/Angular/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="list-container">
2-
<dx-list [dataSource]="products" height="100%">
2+
<dx-list [dataSource]="products" height="100%" displayExpr="Name">
33
<div *dxTemplate="let item of 'item'">
44
<div class="product">
55
<img alt="{{ item.Name }}" src="{{ item.ImageSrc }}" />

apps/demos/Demos/List/ItemTemplate/React/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const App = () => (
88
<List
99
dataSource={products}
1010
height="100%"
11+
displayExpr="Name"
1112
itemRender={ProductInfo} />
1213
</div>
1314
);

apps/demos/Demos/List/ItemTemplate/ReactJs/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const App = () => (
88
<List
99
dataSource={products}
1010
height="100%"
11+
displayExpr="Name"
1112
itemRender={ProductInfo}
1213
/>
1314
</div>

apps/demos/Demos/List/ItemTemplate/Vue/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<DxList
44
:data-source="dataSource"
55
height="100%"
6+
display-expr="Name"
67
>
78
<template #item="{ data: item }">
89
<ProductInfo :item="item"/>

apps/demos/Demos/List/ItemTemplate/jQuery/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ $(() => {
99
$('#listWidget').dxList({
1010
dataSource: products,
1111
height: '100%',
12+
displayExpr: 'Name',
1213
itemTemplate(data) {
1314
const result = $('<div>').addClass('product');
1415

packages/devextreme/js/__internal/ui/list/m_list.edit.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { dxElementWrapper } from '@js/core/renderer';
44
import $ from '@js/core/renderer';
55
import { extend } from '@js/core/utils/extend';
66
import type { Item } from '@js/ui/list';
7-
import { isNumeric } from '@ts/core/utils/m_type';
7+
import { isNumeric, isObject } from '@ts/core/utils/m_type';
88
import type { OptionChanged } from '@ts/core/widget/types';
99

1010
import type { ListBaseProperties } from './m_list.base';
@@ -229,11 +229,15 @@ class ListEdit extends ListBase {
229229
return $itemFrame;
230230
}
231231

232-
_updateItemAriaLabel($itemFrame, itemData) {
232+
_updateItemAriaLabel($itemFrame: dxElementWrapper, itemData: Item): void {
233233
// @ts-expect-error ts-error
234234
const label = this._displayGetter?.(itemData) ?? itemData?.text ?? itemData;
235235

236-
this.setAria('label', label, $itemFrame);
236+
this.setAria(
237+
'label',
238+
isObject(label) ? localizationMessage.format('dxList-listAriaLabel-itemContent') : label,
239+
$itemFrame,
240+
);
237241
}
238242

239243
_selectedItemClass() {

packages/devextreme/js/localization/messages/ar.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"dxList-selectAll-checked": "Checked",
5656
"dxList-selectAll-notChecked": "Not checked",
5757
"dxList-ariaRoleDescription": "List",
58+
"dxList-listAriaLabel-itemContent": "List item content",
5859

5960
"dxScrollView-pullingDownText": "للتحديث اسحب للأسفل...",
6061
"dxScrollView-pulledDownText": "حرر للتحديث ...",

packages/devextreme/js/localization/messages/bg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"dxList-selectAll-checked": "Checked",
5656
"dxList-selectAll-notChecked": "Not checked",
5757
"dxList-ariaRoleDescription": "List",
58+
"dxList-listAriaLabel-itemContent": "List item content",
5859

5960
"dxScrollView-pullingDownText": "Pull down to refresh...",
6061
"dxScrollView-pulledDownText": "Release to refresh...",

packages/devextreme/js/localization/messages/ca.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"dxList-selectAll-checked": "Checked",
5656
"dxList-selectAll-notChecked": "Not checked",
5757
"dxList-ariaRoleDescription": "List",
58+
"dxList-listAriaLabel-itemContent": "List item content",
5859

5960
"dxScrollView-pullingDownText": "Tireu cap avall per refrescar -se ...",
6061
"dxScrollView-pulledDownText": "Allibereu a refresc ...",

packages/devextreme/js/localization/messages/cs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"dxList-selectAll-checked": "Checked",
5656
"dxList-selectAll-notChecked": "Not checked",
5757
"dxList-ariaRoleDescription": "List",
58+
"dxList-listAriaLabel-itemContent": "List item content",
5859

5960
"dxScrollView-pullingDownText": "Stáhněte dolů pro obnovení...",
6061
"dxScrollView-pulledDownText": "Uvolněte pro obnovení...",

0 commit comments

Comments
 (0)