Skip to content
Open
3 changes: 3 additions & 0 deletions assets/js/src/core/components/element-tree/element-tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface TreeProps {
onRightClick?: (event: React.MouseEvent, node: TreeNode) => void

showRoot: boolean
ariaLabel?: string
}

export interface INodeRef {
Expand Down Expand Up @@ -132,8 +133,10 @@ const ElementTree = (
const treeTestId = createTreeTestId(treeId)
const treeContent = (
<div
aria-label={ props.ariaLabel }
className={ ['tree', styles.tree].join(' ') }
data-testid={ treeTestId }
role="tree"
>
<TreeContext.Provider value={ treeContextValue }>

Expand Down
5 changes: 3 additions & 2 deletions assets/js/src/core/components/element-tree/list/tree-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ export const TreeList = ({ node }: TreeListProps): React.JSX.Element => {
</div>
)}

<div
<ul
className='tree-list'
data-testid={ `tree-list-${node.id}` }
style={ { listStyle: 'none', margin: 0, padding: 0 } }
>
{childrenIds.map((childId) => (
<TreeListNode
Expand All @@ -64,7 +65,7 @@ export const TreeList = ({ node }: TreeListProps): React.JSX.Element => {
nodeId={ childId }
/>
))}
</div>
</ul>

{RenderPager !== undefined && (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,17 @@ const TreeNode = forwardRef(function ForwardedTreeNode ({
const nodeContent = (
<Flex
align="center"
aria-expanded={ props.hasChildren === true ? isExpanded : undefined }
aria-level={ Math.max(1, level + 1) }
aria-selected={ isSelected }
className={ cn('tree-node__content-inner') }
gap="small"
justify="center"
onClick={ onClick }
onContextMenu={ onContextMenu }
onKeyDown={ onKeyDown }
ref={ setRef }
role='button'
role='treeitem'
tabIndex={ -1 }
>
<Flex
Expand Down
3 changes: 3 additions & 0 deletions assets/js/src/core/modules/asset/tree/tree-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { componentConfig } from '@Pimcore/modules/app/component-registry/compone
import { useAppDispatch } from '@sdk/app'
import { withDndUpload } from './node/with-dnd-upload'
import { withContextMenu } from './node/with-context-menu'
import { useTranslation } from 'react-i18next'

export interface TreeContainerProps {
id: number
Expand All @@ -36,6 +37,7 @@ export interface TreeContainerProps {
export const AssetTreeNode = withDroppableStyling(withDroppable((withDndUpload(withActionStates(withDraggable(withContextMenu(TreeNodeComponent)))))))

const TreeContainer = ({ id = 1, showRoot = true }: TreeContainerProps): React.JSX.Element => {
const { t } = useTranslation()
const { rootNode, isLoading } = useElementTreeRootNode(id, showRoot)
const componentRegistry = useComponentRegistry()
const dispatch = useAppDispatch()
Expand Down Expand Up @@ -63,6 +65,7 @@ const TreeContainer = ({ id = 1, showRoot = true }: TreeContainerProps): React.J

return (
<ElementTree
ariaLabel={ t('asset.asset-tree.title') }
contextMenu={ contextMenu as React.ElementType<TreeContextMenuProps> | undefined }
nodeId={ id }
onSelect={ onSelect }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { componentConfig } from '@Pimcore/modules/app/component-registry/compone
import { useComponentRegistry } from '@Pimcore/modules/app/component-registry/use-component-registry'
import { useAppDispatch } from '@sdk/app'
import { withContextMenu } from './node/with-context-menu'
import { useTranslation } from 'react-i18next'

export interface TreeContainerProps {
id: number
Expand All @@ -34,6 +35,7 @@ export interface TreeContainerProps {
export const DataObjectTreeNode = withDroppable(withActionStates(withDraggable(withContextMenu(TreeNodeComponent))))

const TreeContainer = ({ id = 1, showRoot = true }: TreeContainerProps): React.JSX.Element => {
const { t } = useTranslation()
const { openDataObject } = useDataObjectHelper()
const { rootNode, isLoading } = useElementTreeRootNode(id, showRoot)
const componentRegistry = useComponentRegistry()
Expand Down Expand Up @@ -64,6 +66,7 @@ const TreeContainer = ({ id = 1, showRoot = true }: TreeContainerProps): React.J

return (
<ElementTree
ariaLabel={ t('data-object.data-object-tree.title') }
contextMenu={ contextMenu as React.ElementType<TreeContextMenuProps> | undefined }
nodeId={ id }
onSelect={ onSelect }
Expand Down
3 changes: 3 additions & 0 deletions assets/js/src/core/modules/document/tree/tree-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { componentConfig } from '@Pimcore/modules/app/component-registry/compone
import { useComponentRegistry } from '@Pimcore/modules/app/component-registry/use-component-registry'
import { useAppDispatch } from '@sdk/app'
import { withContextMenu } from './node/with-context-menu'
import { useTranslation } from 'react-i18next'

export interface TreeContainerProps {
id: number
Expand All @@ -34,6 +35,7 @@ export interface TreeContainerProps {
export const DocumentTreeNode = withDroppable(withActionStates(withDraggable(withContextMenu(TreeNodeComponent))))

const TreeContainer = ({ id = 1, showRoot = true }: TreeContainerProps): React.JSX.Element => {
const { t } = useTranslation()
const { openDocument } = useDocumentHelper()
const { rootNode, isLoading } = useElementTreeRootNode(id, showRoot)
const componentRegistry = useComponentRegistry()
Expand Down Expand Up @@ -64,6 +66,7 @@ const TreeContainer = ({ id = 1, showRoot = true }: TreeContainerProps): React.J

return (
<ElementTree
ariaLabel={ t('document.document-tree.title') }
contextMenu={ contextMenu as React.ElementType<TreeContextMenuProps> | undefined }
nodeId={ id }
onSelect={ onSelect }
Expand Down
Binary file not shown.
Loading