Skip to content

Commit 9602322

Browse files
authored
add aria-expanded attribute (#223)
1 parent 7f8c0e1 commit 9602322

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

modules/e2e/cypress/e2e/gmail-spec.cy.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ describe("Testing the Gmail Demo", () => {
6161

6262
// On a folder that is closed
6363
cy.get("@item").contains("Categories").click(); // closed it
64+
cy.focused().should("have.attr", "aria-expanded", "false");
6465
cy.focused().type("a");
6566
cy.focused().type("Root{enter}");
6667
cy.get("@item").contains("Root").click();
6768
cy.focused().should("have.attr", "aria-level", "1");
6869

6970
// On a folder that is open
7071
cy.get("@item").contains("Categories").click(); // opened it
72+
cy.focused().should("have.attr", "aria-expanded", "true");
7173
cy.focused().type("a");
7274
cy.focused().type("Child{enter}");
7375
cy.get("@item").contains("Child").click();
@@ -91,6 +93,7 @@ describe("Testing the Gmail Demo", () => {
9193

9294
// On a folder that is closed
9395
cy.get("@item").contains("Categories").click(); // closed it
96+
cy.focused().should("have.attr", "aria-expanded", "false");
9497
cy.focused().type("A");
9598
cy.focused().type("Root{enter}");
9699
cy.get("@item").contains("Root").click();
@@ -99,6 +102,7 @@ describe("Testing the Gmail Demo", () => {
99102

100103
// On a folder that is open
101104
cy.get("@item").contains("Categories").click(); // opened it
105+
cy.focused().should("have.attr", "aria-expanded", "true");
102106
cy.focused().type("A");
103107
cy.focused().type("Child{enter}");
104108
cy.get("@item").contains("Child").click();

modules/react-arborist/src/components/row-container.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const RowContainer = React.memo(function RowContainer<T>({
6060
role: "treeitem",
6161
"aria-level": node.level + 1,
6262
"aria-selected": node.isSelected,
63+
"aria-expanded": node.isOpen,
6364
style: rowStyle,
6465
tabIndex: -1,
6566
className: tree.props.rowClassName,

0 commit comments

Comments
 (0)