Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aria-expanded attribute to rows #223

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
add aria-expanded attribute
  • Loading branch information
lidiagc committed Mar 12, 2024
commit 7fe01ca36eeb5ea35810d317a6f9aa587803cd1b
4 changes: 4 additions & 0 deletions modules/e2e/cypress/e2e/gmail-spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ describe("Testing the Gmail Demo", () => {

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

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

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

// On a folder that is open
cy.get("@item").contains("Categories").click(); // opened it
cy.focused().should("have.attr", "aria-expanded", "true");
cy.focused().type("A");
cy.focused().type("Child{enter}");
cy.get("@item").contains("Child").click();
Expand Down
1 change: 1 addition & 0 deletions modules/react-arborist/src/components/row-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const RowContainer = React.memo(function RowContainer<T>({
role: "treeitem",
"aria-level": node.level + 1,
"aria-selected": node.isSelected,
"aria-expanded": node.isOpen,
style: rowStyle,
tabIndex: -1,
className: tree.props.rowClassName,
Expand Down