Skip to content

Commit

Permalink
feat(TreeNode): set aria-current on current active node (#6937)
Browse files Browse the repository at this point in the history
* feat(TreeNode): set aria-current on current active node

* chore: update snapshots

* Add aria-multiselectable="true" for multiselect tree

* fix(TreeView): cast aria-multiselectable to null if falsey

* chore: update snapshots

Co-authored-by: Carolyn MacLeod <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 2, 2020
1 parent 744f76d commit 282bdd4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react/src/components/TreeView/TreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export default function TreeNode({

const treeNodeProps = {
...rest,
['aria-current']: isActive || null,
['aria-selected']: disabled ? null : isSelected,
['aria-disabled']: disabled,
className: treeNodeClasses,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/TreeView/TreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export default function TreeView({
{...rest}
aria-label={hideLabel ? label : null}
aria-labelledby={!hideLabel ? labelId : null}
aria-multiselectable={multiselect || null}
className={treeClasses}
onKeyDown={handleKeyDown}
ref={treeRootRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`TreeView should render 1`] = `
<ul
aria-label={null}
aria-labelledby="id1__label"
aria-multiselectable={null}
className="bx--tree"
onKeyDown={[Function]}
role="tree"
Expand All @@ -41,6 +42,7 @@ exports[`TreeView should render 1`] = `
value="1"
>
<li
aria-current={null}
aria-selected={true}
className="bx--tree-node bx--tree-node--selected bx--tree-leaf-node"
id="1"
Expand Down Expand Up @@ -75,6 +77,7 @@ exports[`TreeView should render 1`] = `
value="2"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-leaf-node"
id="2"
Expand Down Expand Up @@ -109,6 +112,7 @@ exports[`TreeView should render 1`] = `
value="5"
>
<li
aria-current={null}
aria-expanded={true}
aria-selected={false}
className="bx--tree-node bx--tree-parent-node"
Expand Down Expand Up @@ -182,6 +186,7 @@ exports[`TreeView should render 1`] = `
value="5-1"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-leaf-node"
id="5-1"
Expand Down Expand Up @@ -214,6 +219,7 @@ exports[`TreeView should render 1`] = `
value="5-2"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-leaf-node"
id="5-2"
Expand Down Expand Up @@ -247,6 +253,7 @@ exports[`TreeView should render 1`] = `
value="5-3"
>
<li
aria-current={null}
aria-expanded={true}
aria-selected={false}
className="bx--tree-node bx--tree-parent-node"
Expand Down Expand Up @@ -320,6 +327,7 @@ exports[`TreeView should render 1`] = `
value="5-4"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-leaf-node"
id="5-4"
Expand Down Expand Up @@ -367,6 +375,7 @@ exports[`TreeView should render with icons 1`] = `
<ul
aria-label={null}
aria-labelledby="id3__label"
aria-multiselectable={null}
className="bx--tree"
onKeyDown={[Function]}
role="tree"
Expand All @@ -393,6 +402,7 @@ exports[`TreeView should render with icons 1`] = `
value="1"
>
<li
aria-current={null}
aria-selected={true}
className="bx--tree-node bx--tree-node--selected bx--tree-node--with-icon bx--tree-leaf-node"
id="1"
Expand Down Expand Up @@ -464,6 +474,7 @@ exports[`TreeView should render with icons 1`] = `
value="2"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-node--with-icon bx--tree-leaf-node"
id="2"
Expand Down Expand Up @@ -536,6 +547,7 @@ exports[`TreeView should render with icons 1`] = `
value="5"
>
<li
aria-current={null}
aria-expanded={true}
aria-selected={false}
className="bx--tree-node bx--tree-node--with-icon bx--tree-parent-node"
Expand Down Expand Up @@ -644,6 +656,7 @@ exports[`TreeView should render with icons 1`] = `
value="5-1"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-node--with-icon bx--tree-leaf-node"
id="5-1"
Expand Down Expand Up @@ -714,6 +727,7 @@ exports[`TreeView should render with icons 1`] = `
value="5-2"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-node--with-icon bx--tree-leaf-node"
id="5-2"
Expand Down Expand Up @@ -785,6 +799,7 @@ exports[`TreeView should render with icons 1`] = `
value="5-3"
>
<li
aria-current={null}
aria-expanded={true}
aria-selected={false}
className="bx--tree-node bx--tree-node--with-icon bx--tree-parent-node"
Expand Down Expand Up @@ -893,6 +908,7 @@ exports[`TreeView should render with icons 1`] = `
value="5-4"
>
<li
aria-current={null}
aria-selected={false}
className="bx--tree-node bx--tree-node--with-icon bx--tree-leaf-node"
id="5-4"
Expand Down

0 comments on commit 282bdd4

Please sign in to comment.