-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-list, ui5-tree): support accessible description (#10131)
Related to: #6445 Description This PR adds support for the aria-describedby and the aria-description attribute to the ui5-list and ui5-tree components. These attributes allows developers to provide a reference to an element that describes the list or a string value, which can be read by screen readers. Example aria-description A property accessibleDescription is added to the ui5-list and ui5-tree components. When set, the value of this property will be used as the accessible description of the list. <ui5-list accessible-description="This is a list of items">...</ui5-list> <ui5-tree accessible-description="This is a tree of items">...</ui5-tree> aria-describedby A property accessibleDescriptionRef is added to the ui5-list and ui5-tree components. When set, the value of this property will be used as the id of the element that describes the list. <p id="description">This component has description</p> <ui5-list accessible-description-ref="description">...</ui5-list> <ui5-tree accessible-description-ref="description">...</ui5-tree> Changes ui5-list and ui5-tree components now support the accessibleDescription and accessibleDescriptionRef properties An already existing utility named AriaLabelHelper was extended with a new methods getEffectiveAriaDescriptionText and getAllAccessibleDescriptionRefTexts to handle the new properties, similar to the ones for the aria-label attribute the name of the utility was changed to AccessibleTextsHelper to better reflect its purpose the ui5-list now subscribes for changes of the referenced elements using the AccessibleTextsHelper to update the aria-description and aria-label attribute of the list as well the ui5-tree only forwards the values to the internal ui5-tree-list which handles the property to attribute transformation
- Loading branch information
1 parent
4a591a8
commit 45f0ffe
Showing
34 changed files
with
298 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { html } from "lit"; | ||
import "../../src/Tree.js"; | ||
import "../../src/TreeItem.js"; | ||
|
||
describe("Tree Tests", () => { | ||
it("tests accessibility properties forwarded to the list", () => { | ||
cy.mount(html` | ||
<ui5-tree | ||
accessible-name="Tree" | ||
accessible-name-ref="lblDesc1" | ||
accessible-description="Description" | ||
accessible-description-ref="lblDesc2" | ||
></ui5-tree> | ||
<div id="lblDesc1">Tree</div> | ||
<div id="lblDesc2">Description</div> | ||
`); | ||
|
||
cy.get("[ui5-tree]") | ||
.as("tree"); | ||
|
||
cy.get("@tree") | ||
.shadow() | ||
.find(".ui5-tree-root") | ||
.should("have.attr", "accessible-name", "Tree") | ||
.and("have.attr", "accessible-name-ref", "lblDesc1") | ||
.and("have.attr", "accessible-description", "Description") | ||
.and("have.attr", "accessible-description-ref", "lblDesc2"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.