diff --git a/.changeset/actionlist-a11y-fixes.md b/.changeset/actionlist-a11y-fixes.md new file mode 100644 index 00000000000..54579c5faf2 --- /dev/null +++ b/.changeset/actionlist-a11y-fixes.md @@ -0,0 +1,6 @@ +--- +"@primer/react": patch +--- + +ActionList: Add focus styles for Windows high contrast mode +ActionList: Fix incorrect role for ActionList.Group outside ActionMenu diff --git a/src/ActionList/Group.tsx b/src/ActionList/Group.tsx index 74afa85018f..d6f2715c325 100644 --- a/src/ActionList/Group.tsx +++ b/src/ActionList/Group.tsx @@ -50,7 +50,7 @@ export const Group: React.FC = ({ return ( ( } }, + '@media (forced-colors: active)': { + ':focus': { + // we set color to be transparent and let the high contrast rules + // decide what color with contrast should that be corrected to + outline: 'solid 1px transparent !important' + } + }, + /** Divider styles */ '[data-component="ActionList.Item--DividerContainer"]': { position: 'relative' diff --git a/src/stories/ActionList/examples.stories.tsx b/src/stories/ActionList/examples.stories.tsx index fdf306934bd..6fdd05d7595 100644 --- a/src/stories/ActionList/examples.stories.tsx +++ b/src/stories/ActionList/examples.stories.tsx @@ -15,7 +15,7 @@ import { XIcon } from '@primer/octicons-react' -import {ThemeProvider} from '../..' +import {Heading, ThemeProvider} from '../..' import {ActionList} from '../../ActionList' import BaseStyles from '../../BaseStyles' import Avatar from '../../Avatar' @@ -49,9 +49,16 @@ export function WithLinks(): JSX.Element { <>

With Links

-

This pattern can be seen in the repository sidebar, containing a list of links

+

This pattern can be seen in the repository sidebar, containing a list of links.

+

+ The heading "Details" is outside the ActionList and needs to have an id which is passed + to ActionList with aria-labelledby. +

- + + Details + +