diff --git a/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx b/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx index cdf6e98ec0c64..96d01eba36bcc 100644 --- a/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx +++ b/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx @@ -226,17 +226,13 @@ describe('', () => { }); it('should be able to use a custom id', () => { - const { getByRole, getByTestId } = render( + const { getByRole } = render( , ); - act(() => { - getByTestId('one').focus(); - }); - - expect(getByRole('tree')).to.have.attribute('aria-activedescendant', 'customId'); + expect(getByRole('treeitem')).to.have.attribute('id', 'customId'); }); describe('Accessibility', () => { diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.ts index 7f579a85adf91..698d7fffa06b2 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.ts @@ -143,15 +143,9 @@ export const useTreeViewFocus: TreeViewPlugin = ({ } }; - const focusedItem = instance.getItemMeta(state.focusedItemId!); - const activeDescendant = focusedItem - ? instance.getTreeItemIdAttribute(focusedItem.id, focusedItem.idAttribute) - : null; - return { getRootProps: (otherHandlers) => ({ onFocus: createRootHandleFocus(otherHandlers), - 'aria-activedescendant': activeDescendant ?? undefined, }), publicAPI: { focusItem, diff --git a/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts b/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts index be559ac10dd93..0ff481abccae7 100644 --- a/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts +++ b/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts @@ -35,14 +35,7 @@ export type UseTreeViewDefaultizedParameters< export interface UseTreeViewRootSlotProps extends Pick< React.HTMLAttributes, - | 'onFocus' - | 'onBlur' - | 'onKeyDown' - | 'id' - | 'aria-activedescendant' - | 'aria-multiselectable' - | 'role' - | 'tabIndex' + 'onFocus' | 'onBlur' | 'onKeyDown' | 'id' | 'aria-multiselectable' | 'role' | 'tabIndex' > { ref: React.Ref; }