diff --git a/packages/material-ui-lab/src/TreeItem/TreeItem.js b/packages/material-ui-lab/src/TreeItem/TreeItem.js index edbdc1b67bc96a..461f51551362da 100644 --- a/packages/material-ui-lab/src/TreeItem/TreeItem.js +++ b/packages/material-ui-lab/src/TreeItem/TreeItem.js @@ -366,13 +366,13 @@ const TreeItem = React.forwardRef(function TreeItem(props, ref) { }, [focused]); let ariaSelected; - if (!selectionDisabled) { - if (multiSelect) { - ariaSelected = selected; - } else if (selected) { - ariaSelected = true; - } + if (multiSelect) { + ariaSelected = selected; + } else if (selected) { + // single-selection trees unset aria-selected + ariaSelected = true; } + return (
  • ', () => { expect(getByTestId('test')).to.have.attribute('aria-selected', 'true'); }); - it('should not have the attribute `aria-selected` if disableSelection is true', () => { + it('should have the attribute `aria-selected` if disableSelection is true', () => { const { getByTestId } = render( , ); - expect(getByTestId('test')).to.not.have.attribute('aria-selected'); + expect(getByTestId('test')).to.have.attribute('aria-selected', 'false'); }); }); });