Skip to content

Commit 1e90bda

Browse files
committed
fix group roles based on latest discussion
1 parent 766c2b1 commit 1e90bda

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/ActionList2/Group.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {useSSRSafeId} from '@react-aria/ssr'
33
import Box from '../Box'
44
import {SxProp} from '../sx'
55
import {ListContext, ListProps} from './List'
6-
import {AriaRole} from '../utils/types'
76

87
export type GroupProps = {
98
/**
@@ -24,7 +23,6 @@ export type GroupProps = {
2423
/**
2524
* The ARIA role describing the function of the list inside `Group` component. `listbox` or `menu` are a common values.
2625
*/
27-
role?: AriaRole
2826
} & SxProp & {
2927
/**
3028
* Whether multiple Items or a single Item can be selected in the Group. Overrides value on ActionList root.
@@ -40,7 +38,6 @@ export const Group: React.FC<GroupProps> = ({
4038
variant = 'subtle',
4139
auxiliaryText,
4240
selectionVariant,
43-
role,
4441
sx = {},
4542
...props
4643
}) => {
@@ -49,6 +46,7 @@ export const Group: React.FC<GroupProps> = ({
4946
return (
5047
<Box
5148
as="li"
49+
role="none"
5250
sx={{
5351
'&:not(:first-child)': {marginTop: 2},
5452
listStyle: 'none', // hide the ::marker inserted by browser's stylesheet
@@ -58,7 +56,7 @@ export const Group: React.FC<GroupProps> = ({
5856
>
5957
{title && <Header title={title} variant={variant} auxiliaryText={auxiliaryText} labelId={labelId} />}
6058
<GroupContext.Provider value={{selectionVariant}}>
61-
<Box as="ul" sx={{paddingInlineStart: 0}} aria-labelledby={title ? labelId : undefined} role={role}>
59+
<Box as="ul" sx={{paddingInlineStart: 0}} aria-labelledby={title ? labelId : undefined} role="group">
6260
{props.children}
6361
</Box>
6462
</GroupContext.Provider>

src/stories/ActionMenu2/examples.stories.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ export function GroupsAndDescription(): JSX.Element {
171171
Milestone
172172
</ActionMenu.Button>
173173
<ActionMenu.Overlay width="medium">
174-
<ActionList selectionVariant="single" showDividers role="none">
175-
<ActionList.Group title="Open" role="menu">
174+
<ActionList selectionVariant="single" showDividers>
175+
<ActionList.Group title="Open">
176176
{milestones
177177
.filter(milestone => !milestone.name.includes('21'))
178178
.map((milestone, index) => (
@@ -189,7 +189,7 @@ export function GroupsAndDescription(): JSX.Element {
189189
</ActionList.Item>
190190
))}
191191
</ActionList.Group>
192-
<ActionList.Group title="Closed" role="menu">
192+
<ActionList.Group title="Closed">
193193
{milestones
194194
.filter(milestone => milestone.name.includes('21'))
195195
.map((milestone, index) => (
@@ -270,7 +270,6 @@ export function MultipleSelection(): JSX.Element {
270270
<ActionList selectionVariant="multiple" showDividers>
271271
{users.map(user => (
272272
<ActionList.Item
273-
role="option"
274273
key={user.login}
275274
selected={Boolean(assignees.find(assignee => assignee.login === user.login))}
276275
onSelect={() => toggleAssignee(user)}
@@ -313,16 +312,16 @@ export function MixedSelection(): JSX.Element {
313312
is an action. This pattern appears inside a ActionMenu for selection view options in Memex
314313
</p>
315314

316-
<ActionMenu>
315+
<ActionMenu open={true}>
317316
<ActionMenu.Button
318317
aria-label="Select field type to group by"
319318
leadingIcon={selectedOption && selectedOption.icon}
320319
>
321320
{selectedOption ? `Group by ${selectedOption.text}` : 'Group items by'}
322321
</ActionMenu.Button>
323322
<ActionMenu.Overlay width="medium">
324-
<ActionList role="none">
325-
<ActionList.Group selectionVariant="single" title="Group by" role="menu">
323+
<ActionList>
324+
<ActionList.Group selectionVariant="single" title="Group by">
326325
{options.map((option, index) => (
327326
<ActionList.Item
328327
key={index}
@@ -337,9 +336,9 @@ export function MixedSelection(): JSX.Element {
337336
))}
338337
</ActionList.Group>
339338
{typeof selectedIndex === 'number' && (
340-
<ActionList.Group role="menu">
339+
<ActionList.Group selectionVariant={false}>
341340
<ActionList.Divider />
342-
<ActionList.Item onSelect={() => setSelectedIndex(null)} role="menuitem">
341+
<ActionList.Item onSelect={() => setSelectedIndex(null)}>
343342
<ActionList.LeadingVisual>
344343
<XIcon />
345344
</ActionList.LeadingVisual>

0 commit comments

Comments
 (0)