Skip to content

Commit

Permalink
[PR feedback] aria-expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Feb 7, 2024
1 parent 1845fbf commit 9c2a84d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelogs/upcoming/7513.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
**Bug fixes**

- Fixed an `EuiTreeView` bug where `aria-expanded` was being applied to items without expandable children

**CSS-in-JS conversions**

- Converted `EuiTreeView` to Emotion. Updates as part of the conversion:
Expand Down
4 changes: 3 additions & 1 deletion src/components/tree_view/tree_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ export class EuiTreeViewClass extends Component<
{items.map((node, index) => {
const buttonId = node.id;
const wrappingId = this.treeIdGenerator(buttonId);
const isNodeExpanded = this.isNodeOpen(node);
const isNodeExpanded = node.children
? this.isNodeOpen(node)
: undefined; // Determines the `aria-expanded` attribute

let icon = node.icon;
if (node.iconWhenExpanded && isNodeExpanded) {
Expand Down

0 comments on commit 9c2a84d

Please sign in to comment.