Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -169,6 +170,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -500,6 +502,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource with exclude
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -537,6 +540,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource with exclude
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -868,6 +872,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource with exclude
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -905,6 +910,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource with exclude
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -1236,6 +1242,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource with filter v
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -1273,6 +1280,7 @@ exports[`Options Column.HeaderFilter dataSource: custom dataSource with filter v
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -1604,6 +1612,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter 1`] = `
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -1641,6 +1650,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter 1`] = `
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -1678,6 +1688,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter 1`] = `
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -1715,6 +1726,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter 1`] = `
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -1752,6 +1764,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter 1`] = `
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2083,6 +2096,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter with va
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2120,6 +2134,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter with va
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2157,6 +2172,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter with va
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2194,6 +2210,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter with va
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2231,6 +2248,7 @@ exports[`Options Column.HeaderFilter filterType + values: exclude filter with va
aria-selected="true"
class="dx-item dx-list-item dx-list-item-selected"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2562,6 +2580,7 @@ exports[`Options Column.HeaderFilter filterType + values: filter values 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2599,6 +2618,7 @@ exports[`Options Column.HeaderFilter filterType + values: filter values 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2636,6 +2656,7 @@ exports[`Options Column.HeaderFilter filterType + values: filter values 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2673,6 +2694,7 @@ exports[`Options Column.HeaderFilter filterType + values: filter values 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -2710,6 +2732,7 @@ exports[`Options Column.HeaderFilter filterType + values: filter values 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -3041,6 +3064,7 @@ exports[`Options HeaderFilter texts: custom translations 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -3372,6 +3396,7 @@ exports[`Options HeaderFilter texts: default translation 1`] = `
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ exports[`HeaderFilter View integration should render popup with list by default
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -169,6 +170,7 @@ exports[`HeaderFilter View integration should render popup with list by default
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -206,6 +208,7 @@ exports[`HeaderFilter View integration should render popup with list by default
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -243,6 +246,7 @@ exports[`HeaderFilter View integration should render popup with list by default
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -280,6 +284,7 @@ exports[`HeaderFilter View integration should render popup with list by default
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -611,6 +616,7 @@ exports[`HeaderFilter View integration should render popup with tree list if dat
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -648,6 +654,7 @@ exports[`HeaderFilter View integration should render popup with tree list if dat
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -685,6 +692,7 @@ exports[`HeaderFilter View integration should render popup with tree list if dat
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -722,6 +730,7 @@ exports[`HeaderFilter View integration should render popup with tree list if dat
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down Expand Up @@ -759,6 +768,7 @@ exports[`HeaderFilter View integration should render popup with tree list if dat
aria-selected="false"
class="dx-item dx-list-item"
role="option"
tabindex="-1"
>
<div
class="dx-list-item-before-bag dx-list-select-checkbox-container"
Expand Down
31 changes: 30 additions & 1 deletion packages/devextreme/js/__internal/ui/list/list.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> {
groupTemplate: 'group',
indicateLoading: true,
activeStateEnabled: true,
_itemAttributes: { role: 'option' },
_itemAttributes: { role: 'option', tabindex: '-1' },
useInkRipple: false,
wrapItemText: false,
showChevronExpr(data: Item): boolean | undefined {
Expand Down Expand Up @@ -1029,6 +1029,35 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> {
return this._itemContainer();
}

_handleItemFocus(e: DxEvent): void {
if (e.isDefaultPrevented()) {
return;
}

const $target = $(e.target);
const $closestItem = $target.closest(this._itemElements());

if (!$closestItem.length) {
return;
}

const $closestFocusable = this._closestFocusable($target);
const isFocusOnItem = !$closestFocusable?.length || $closestFocusable.is($closestItem);

if (!isFocusOnItem) {
return;
}

this._shouldSkipSelectOnFocus = true;
this.option('focusedElement', getPublicElement($closestItem));
this._shouldSkipSelectOnFocus = false;

const focusTarget = this._focusTarget().get(0) as HTMLElement | undefined;
if (focusTarget && focusTarget !== e.target) {
focusTarget.focus({ preventScroll: true });
}
Comment thread
pharret31 marked this conversation as resolved.
}

_renderInkRipple(): void {
this._inkRipple = render();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ if(devices.real().deviceType === 'desktop') {
helper.checkAttributes(helper.$itemContainer, this.expectedContainerAttrs);
helper.checkAttributes(helper.getListContainer(), this.expectedItemsContainerAttrs);
helper.checkAttributes(helper.$widget, this.expectedListAttrs);
helper.checkItemsAttributes([], { role: 'option' });
helper.checkItemsAttributes([], { role: 'option', tabindex: '-1' });
});

QUnit.test('Selected: ["Item_2"], change searchEnabled after initialize', function() {
Expand All @@ -322,7 +322,7 @@ if(devices.real().deviceType === 'desktop') {
helper.checkAttributes(helper.$itemContainer, this.expectedContainerAttrs);
helper.checkAttributes(helper.getListContainer(), this.expectedItemsContainerAttrs);
helper.checkAttributes(helper.$widget, this.expectedListAttrs);
helper.checkItemsAttributes([1], { attributes: ['aria-selected'], role: 'option' });
helper.checkItemsAttributes([1], { attributes: ['aria-selected'], role: 'option', tabindex: '-1' });
});

QUnit.test('Selected: ["Item_2"], selectionMode: "single"', function() {
Expand All @@ -336,7 +336,7 @@ if(devices.real().deviceType === 'desktop') {
helper.checkAttributes(helper.$itemContainer, this.expectedContainerAttrs);
helper.checkAttributes(helper.getListContainer(), this.expectedItemsContainerAttrs);
helper.checkAttributes(helper.$widget, this.expectedListAttrs);
helper.checkItemsAttributes([1], { attributes: ['aria-selected'], role: 'option' });
helper.checkItemsAttributes([1], { attributes: ['aria-selected'], role: 'option', tabindex: '-1' });
});

QUnit.test('Selected: ["Item_2", "Item_3"], selectionMode: "multiple"', function() {
Expand All @@ -350,7 +350,7 @@ if(devices.real().deviceType === 'desktop') {
helper.checkAttributes(helper.$itemContainer, this.expectedContainerAttrs);
helper.checkAttributes(helper.getListContainer(), this.expectedItemsContainerMultipleModeAttrs);
helper.checkAttributes(helper.$widget, this.expectedListAttrs);
helper.checkItemsAttributes([1, 2], { attributes: ['aria-selected'], role: 'option' });
helper.checkItemsAttributes([1, 2], { attributes: ['aria-selected'], role: 'option', tabindex: '-1' });
});

QUnit.test('Selected: ["Item_1"] -> set focusedElement -> clean focusedElement', function() {
Expand All @@ -364,12 +364,12 @@ if(devices.real().deviceType === 'desktop') {
helper.widget.option('focusedElement', helper.getItems().eq(0));
helper.checkAttributes(helper.$itemContainer, { ...this.expectedContainerAttrs, 'aria-activedescendant': helper.focusedItemId });
helper.checkAttributes(helper.getListContainer(), this.expectedItemsContainerAttrs);
helper.checkItemsAttributes([0], { attributes: ['aria-selected'], focusedItemIndex: 0, role: 'option' });
helper.checkItemsAttributes([0], { attributes: ['aria-selected'], focusedItemIndex: 0, role: 'option', tabindex: '-1' });

helper.widget.option('focusedElement', null);
helper.checkAttributes(helper.$itemContainer, this.expectedContainerAttrs);
helper.checkAttributes(helper.getListContainer(), this.expectedItemsContainerAttrs);
helper.checkItemsAttributes([0], { attributes: ['aria-selected'], role: 'option' });
helper.checkItemsAttributes([0], { attributes: ['aria-selected'], role: 'option', tabindex: '-1' });
});
});

Expand Down
Loading
Loading