As mentioned in the previous answer from Eugene Kashida that we will have to wait for the chrome to fix it.
There is still one workaround that will fix it in case it is critical for you. Note it is a workaround till chrome fixes it.
The tree component and tree-item component is completely open source.
You can use these in your orgs except modify these two lines in the treeItem.js file
You might need to import few labels(lightning_LightningTree_expandBranch,lightning_LightningTree_collapseBranch) and also few private components(utilsPrivate,utils,c-primitive-icon) and everything is in the repository.
Once you have it in your org, change below lines
makeChildFocusable(childKey, shouldFocus) {
const child = this.getImmediateChildItem(childKey);
if (child) {
if (child.tabIndex !== '0') {
child.tabIndex = '0';
}
if (shouldFocus) {
child.focus();
}
child.setAttribute('aria-selected', true);
//child.ariaSelected = true;
}
}
makeChildUnfocusable() {
//this.ariaSelected = 'false';
this.setAttribute('aria-selected', false);
this.removeAttribute('tabindex');
}
Notice the commented lines and new line using setAttribute
In your component instead of using lightning
namespace you will use c
namespace
<template>
<div class="slds-m-top_medium slds-m-bottom_x-large background">
<h2 class="slds-text-heading_medium slds-m-bottom_medium">
Tree component with a few levels of depth. Click on the arrow icons to expand or collapse a branch.
</h2>
<!-- Simple -->
<div class="slds-p-around_medium lgc-bg">
<c-tree items={items} header="Roles"></c-tree>
</div>
</div>
Once chrome fixes it, replace with lightning namespace.