Skip to content

Commit 7aea99e

Browse files
committed
remove aria-rolindex for headers
1 parent 5e6236d commit 7aea99e

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

packages/@react-aria/gridlist/src/useGridListSection.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import {DOMAttributes, Node as RSNode} from '@react-types/shared';
14-
import type {ListState} from '@react-stately/list';
13+
import {DOMAttributes} from '@react-types/shared';
1514
import {useLabels, useSlotId} from '@react-aria/utils';
1615

1716
export interface AriaGridListSectionProps {
1817
/** An accessibility label for the section. Required if `heading` is not present. */
19-
'aria-label'?: string,
20-
/** Whether the list row is contained in a virtual scroller. */
21-
isVirtualized?: boolean,
22-
/** An object representing the list item. Contains all the relevant information that makes up the list row. */
23-
node: RSNode<unknown>
18+
'aria-label'?: string
2419
}
2520

2621
export interface GridListSectionAria {
@@ -39,26 +34,16 @@ export interface GridListSectionAria {
3934
* See `useGridList` for more details about grid list.
4035
* @param props - Props for the section.
4136
*/
42-
export function useGridListSection<T>(props: AriaGridListSectionProps, state: ListState<T>): GridListSectionAria {
43-
let {'aria-label': ariaLabel, isVirtualized, node} = props;
37+
export function useGridListSection(props: AriaGridListSectionProps): GridListSectionAria {
38+
let {'aria-label': ariaLabel} = props;
4439
let headingId = useSlotId();
4540
let labelProps = useLabels({
4641
'aria-label': ariaLabel,
4742
'aria-labelledby': headingId
4843
});
49-
let rowIndex: number | undefined = undefined;
50-
51-
if (isVirtualized) {
52-
let {collection} = state;
53-
let filteredCollection = [...collection.getKeys()].filter((key) => collection.getItem(key)?.type !== 'header');
54-
let prevItem = node.prevKey ? state.collection.getItem(node.prevKey) : undefined;
55-
rowIndex = prevItem ? filteredCollection.findIndex((key) => key === prevItem.key) + 2 : node.index + 1;
56-
}
57-
5844
return {
5945
rowProps: {
60-
role: 'row',
61-
'aria-rowindex': rowIndex
46+
role: 'row'
6247
},
6348
rowHeaderProps: {
6449
id: headingId,

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,11 @@ export interface GridListSectionProps<T> extends SectionProps<T> {}
571571
export const GridListSection = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: GridListSectionProps<T>, ref: ForwardedRef<HTMLElement>, item: Node<T>) => {
572572
let state = useContext(ListStateContext)!;
573573
let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;
574-
let {CollectionBranch, isVirtualized} = useContext(CollectionRendererContext);
574+
let {CollectionBranch} = useContext(CollectionRendererContext);
575575
let headingRef = useRef(null);
576576
let {rowHeaderProps, rowProps, rowGroupProps} = useGridListSection({
577-
'aria-label': props['aria-label'] ?? undefined,
578-
isVirtualized,
579-
node: item
580-
}, state);
577+
'aria-label': props['aria-label'] ?? undefined
578+
});
581579
let renderProps = useRenderProps({
582580
defaultClassName: 'react-aria-GridListSection',
583581
className: props.className,

0 commit comments

Comments
 (0)