Skip to content

Commit 2d4b728

Browse files
authored
fix: update TreeSection to div to prevent accessibility error (adobe#9746)
1 parent f15e67b commit 2d4b728

File tree

1 file changed

+5
-5
lines changed
  • packages/react-aria-components/src

1 file changed

+5
-5
lines changed

packages/react-aria-components/src/Tree.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,16 +1003,16 @@ function RootDropIndicator() {
10031003
);
10041004
}
10051005

1006-
export interface GridListSectionProps<T> extends SectionProps<T>, DOMRenderProps<'section', undefined> {}
1006+
export interface GridListSectionProps<T> extends SectionProps<T>, DOMRenderProps<'div', undefined> {}
10071007

10081008
/**
10091009
* A TreeSection represents a section within a Tree.
10101010
*/
1011-
export const TreeSection = /*#__PURE__*/ createBranchComponent(SectionNode, <T extends object>(props: GridListSectionProps<T>, ref: ForwardedRef<HTMLElement>, item: Node<T>) => {
1011+
export const TreeSection = /*#__PURE__*/ createBranchComponent(SectionNode, <T extends object>(props: GridListSectionProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {
10121012
let state = useContext(TreeStateContext)!;
10131013
let {CollectionBranch} = useContext(CollectionRendererContext);
10141014
let headingRef = useRef(null);
1015-
ref = useObjectRef<HTMLElement>(ref);
1015+
ref = useObjectRef<HTMLDivElement>(ref);
10161016
let {rowHeaderProps, rowProps, rowGroupProps} = useGridListSection({
10171017
'aria-label': props['aria-label'] ?? undefined
10181018
}, state, ref);
@@ -1028,7 +1028,7 @@ export const TreeSection = /*#__PURE__*/ createBranchComponent(SectionNode, <T e
10281028
delete DOMProps.id;
10291029

10301030
return (
1031-
<dom.section
1031+
<dom.div
10321032
{...mergeProps(DOMProps, renderProps, rowGroupProps)}
10331033
ref={ref}>
10341034
<Provider
@@ -1040,7 +1040,7 @@ export const TreeSection = /*#__PURE__*/ createBranchComponent(SectionNode, <T e
10401040
collection={state.collection}
10411041
parent={item} />
10421042
</Provider>
1043-
</dom.section>
1043+
</dom.div>
10441044
);
10451045
});
10461046

0 commit comments

Comments
 (0)