diff --git a/packages/react-core/src/components/TreeView/TreeViewListItem.tsx b/packages/react-core/src/components/TreeView/TreeViewListItem.tsx index 33522e44c5e..f9d9613af09 100644 --- a/packages/react-core/src/components/TreeView/TreeViewListItem.tsx +++ b/packages/react-core/src/components/TreeView/TreeViewListItem.tsx @@ -124,6 +124,7 @@ const TreeViewListItemBase: React.FunctionComponent = ({ } }} {...((hasCheck || isSelectable) && { 'aria-labelledby': `label-${randomId}` })} + {...(ToggleComponent === 'button' && { type: 'button' })} tabIndex={-1} > @@ -156,7 +157,7 @@ const TreeViewListItemBase: React.FunctionComponent = ({ <> {isCompact && title && {title}} {isSelectable ? ( - ) : ( @@ -214,6 +215,7 @@ const TreeViewListItemBase: React.FunctionComponent = ({ }} {...(hasCheck && { htmlFor: randomId })} {...((hasCheck || (isSelectable && children)) && { id: `label-${randomId}` })} + {...(Component === 'button' && { type: 'button' })} > {children && renderToggle(randomId)} diff --git a/packages/react-core/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap b/packages/react-core/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap index 4eaa9c96715..ffe22ccba39 100644 --- a/packages/react-core/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap +++ b/packages/react-core/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap @@ -22,6 +22,7 @@ exports[`renders compact no background successfully 1`] = `