Skip to content

Commit

Permalink
Fix aria-level and aria role violations (#198)
Browse files Browse the repository at this point in the history
Co-authored-by: Shivani Parekh <[email protected]>
  • Loading branch information
sparekh0730 and sparekhh authored Dec 12, 2023
1 parent 5d09da4 commit e165800
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/e2e/cypress/e2e/gmail-spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ describe("Testing the Gmail Demo", () => {
cy.focused().type("a");
cy.focused().type("Root{enter}");
cy.get("@item").contains("Root").click();
cy.focused().should("have.attr", "aria-level", "0");
cy.focused().should("have.attr", "aria-level", "1");

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

it("Creates Internal Nodes", () => {
Expand All @@ -95,14 +95,14 @@ describe("Testing the Gmail Demo", () => {
cy.focused().type("Root{enter}");
cy.get("@item").contains("Root").click();
cy.focused().children().should("have.class", "isInternal");
cy.focused().should("have.attr", "aria-level", "0");
cy.focused().should("have.attr", "aria-level", "1");

// On a folder that is open
cy.get("@item").contains("Categories").click(); // opened it
cy.focused().type("A");
cy.focused().type("Child{enter}");
cy.get("@item").contains("Child").click();
cy.focused().should("have.attr", "aria-level", "1");
cy.focused().should("have.attr", "aria-level", "2");
});

it("drags and drops in its list", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function DefaultContainer() {
const tree = useTreeApi();
return (
<div
role="tree"
style={{
height: tree.height,
width: tree.width,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-arborist/src/components/row-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const RowContainer = React.memo(function RowContainer<T>({
);
const rowAttrs: React.HTMLAttributes<any> = {
role: "treeitem",
"aria-level": node.level,
"aria-level": node.level + 1,
"aria-selected": node.isSelected,
style: rowStyle,
tabIndex: -1,
Expand Down

0 comments on commit e165800

Please sign in to comment.