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

Fix aria-level and aria role violations #198

Merged
merged 1 commit into from
Dec 12, 2023
Merged
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
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
Loading