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
21 changes: 21 additions & 0 deletions packages/main/cypress/specs/List.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,27 @@ describe("List - Accessibility", () => {
});
});

it("does not announce F2 instruction for custom list items without tabbable content", () => {
cy.mount(
<List selectionMode="None">
<ListItemCustom>Pineapple</ListItemCustom>
<ListItemCustom>Papaya</ListItemCustom>
</List>
);

cy.get("[ui5-list]")
.shadow()
.find(".ui5-list-ul")
.invoke("attr", "aria-description")
.then((ariaDesc) => {
cy.get("[ui5-list]")
.should(($list) => {
const defaultText = $list.prop("defaultAriaDescriptionText") as string;
expect(ariaDesc ?? "").to.not.include(defaultText);
});
});
});

it("announces 'Selected' when an item is selected in Single mode via mouse click", () => {
cy.mount(
<List selectionMode="Single">
Expand Down
8 changes: 7 additions & 1 deletion packages/main/src/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,13 @@ class List extends UI5Element {
}

return this.getItems().some(item => {
return item.getAttribute("type") === "Detail" || isInstanceOfListItemCustom(item);
if (item.getAttribute("type") === "Detail") {
return true;
}
if (isInstanceOfListItemCustom(item)) {
return item._hasFocusableElements();
}
return false;
});
}

Expand Down
Loading