diff --git a/.changeset/giant-bobcats-deliver.md b/.changeset/giant-bobcats-deliver.md new file mode 100644 index 00000000000..ada0448a3f7 --- /dev/null +++ b/.changeset/giant-bobcats-deliver.md @@ -0,0 +1,7 @@ +--- +'@primer/react': patch +--- + +Update ActionList to place `id` on item with an ARIA role + + diff --git a/.changeset/purple-panthers-accept.md b/.changeset/purple-panthers-accept.md new file mode 100644 index 00000000000..11443b511e1 --- /dev/null +++ b/.changeset/purple-panthers-accept.md @@ -0,0 +1,7 @@ +--- +'@primer/react': patch +--- + +Button: Allow leadingIcon, trailingIcon, trailingAction to be overridable with sx + + diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-colorblind-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-colorblind-linux.png index 7a6d08b6e3d..10743f3b5c5 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-colorblind-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-dimmed-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-dimmed-linux.png index 8a150d03c56..8e61cdfdb5b 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-dimmed-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-high-contrast-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-high-contrast-linux.png index 42fd585200e..50a169a1c17 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-high-contrast-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-linux.png index 97447d754f5..96757c51768 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-tritanopia-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-tritanopia-linux.png index 7a6d08b6e3d..10743f3b5c5 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-tritanopia-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-colorblind-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-colorblind-linux.png index 38e4599d0a8..d484a89b642 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-colorblind-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-high-contrast-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-high-contrast-linux.png index feca5e28d24..0a9407fb292 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-high-contrast-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-linux.png index 36135cffb0f..2b0a2f46e66 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-linux.png differ diff --git a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-tritanopia-linux.png b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-tritanopia-linux.png index 38e4599d0a8..d484a89b642 100644 Binary files a/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-tritanopia-linux.png and b/.playwright/snapshots/components/Button.test.ts-snapshots/Button-sx-prop-light-tritanopia-linux.png differ diff --git a/src/ActionList/Item.tsx b/src/ActionList/Item.tsx index e7a76362bd3..04a07b00c39 100644 --- a/src/ActionList/Item.tsx +++ b/src/ActionList/Item.tsx @@ -190,10 +190,10 @@ export const Item = React.forwardRef( [onSelect, disabled, afterSelect], ) - // use props.id if provided, otherwise generate one. - const labelId = useId(id) - const inlineDescriptionId = useId(id && `${id}--inline-description`) - const blockDescriptionId = useId(id && `${id}--block-description`) + const itemId = useId(id) + const labelId = `${itemId}--label` + const inlineDescriptionId = `${itemId}--inline-description` + const blockDescriptionId = `${itemId}--block-description` const ItemWrapper = _PrivateItemWrapper || React.Fragment @@ -208,6 +208,7 @@ export const Item = React.forwardRef( 'aria-describedby': slots.description?.props.variant === 'block' ? blockDescriptionId : undefined, ...(selectionAttribute && {[selectionAttribute]: selected}), role: role || itemRole, + id: itemId, } const containerProps = _PrivateItemWrapper ? {role: role || itemRole ? 'none' : undefined} : menuItemProps diff --git a/src/Button/Button.dev.stories.tsx b/src/Button/Button.dev.stories.tsx index d2a06e5019b..ec1f66d12d2 100644 --- a/src/Button/Button.dev.stories.tsx +++ b/src/Button/Button.dev.stories.tsx @@ -1,6 +1,7 @@ -import {SearchIcon, TriangleDownIcon, EyeIcon} from '@primer/octicons-react' +import {SearchIcon, TriangleDownIcon, EyeIcon, IssueClosedIcon} from '@primer/octicons-react' import React from 'react' import {Button, IconButton} from '.' +import {default as Text} from '../Text' export default { title: 'Components/Button/DevOnly', @@ -64,8 +65,11 @@ export const TestSxProp = () => { > Red - +