explorer: fix file tree label

This commit is contained in:
David Lechner
2022-12-16 17:54:36 -06:00
committed by David Lechner
parent f0434b50ed
commit f560370b51
2 changed files with 16 additions and 10 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
}
},
"tree": {
"label": "File Explorer",
"label": "Files",
"liveDescriptor": {
"intro": {
"accessibilityGuide": "Accessibility guide for tree {treeLabel}.",
+15 -9
View File
@@ -16,7 +16,7 @@ import {
MaybeElement,
} from '@blueprintjs/core';
import React, { createContext } from 'react';
import { TreeItem, TreeRenderProps } from 'react-complex-tree';
import { TreeItem, TreeRenderProps, useTree } from 'react-complex-tree';
import { useBoolean } from 'usehooks-ts';
/** Combines class names into a string. */
@@ -42,14 +42,20 @@ export const renderers: Omit<
Required<TreeRenderProps<TreeItemData>>,
'renderDraggingItem' | 'renderDraggingItemTitle' | 'renderLiveDescriptorContainer'
> = {
renderTreeContainer: (props) => (
<div
className={cx(Classes.TREE, Classes.FOCUS_STYLE_MANAGER_IGNORE)}
{...props.containerProps}
>
{props.children}
</div>
),
renderTreeContainer: (props) => {
// work around https://github.com/lukasbach/react-complex-tree/issues/195
const { treeLabel } = useTree();
return (
<div
className={cx(Classes.TREE, Classes.FOCUS_STYLE_MANAGER_IGNORE)}
{...props.containerProps}
aria-label={treeLabel}
>
{props.children}
</div>
);
},
renderItemsContainer: (props) => (
<ul