From e5cb20c69388aab47ee751a76d0921ac2852a9a7 Mon Sep 17 00:00:00 2001 From: Jan Hassel Date: Thu, 25 Feb 2021 20:39:32 +0100 Subject: [PATCH] fix(button): set aria-pressed to props.isSelected for icon-only ghost (#7900) * fix(button): set aria-pressed to props.isSelected for icon-only ghost * test: update snapshots Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/react/src/components/Button/Button.js | 1 + .../__tests__/__snapshots__/DataTable-test.js.snap | 10 ++++++++++ .../__snapshots__/TableBatchAction-test.js.snap | 1 + .../__snapshots__/TableBatchActions-test.js.snap | 2 ++ .../__snapshots__/ModalWrapper-test.js.snap | 3 +++ 5 files changed, 17 insertions(+) diff --git a/packages/react/src/components/Button/Button.js b/packages/react/src/components/Button/Button.js index 00dfc24f5908..c6185f323a61 100644 --- a/packages/react/src/components/Button/Button.js +++ b/packages/react/src/components/Button/Button.js @@ -70,6 +70,7 @@ const Button = React.forwardRef(function Button( let otherProps = { disabled, type, + 'aria-pressed': hasIconOnly && kind === 'ghost' ? isSelected : null, }; const anchorProps = { href, diff --git a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap index 7a087e7d6fb7..f917629852bf 100644 --- a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap +++ b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap @@ -2060,6 +2060,7 @@ exports[`DataTable should render 1`] = ` type="button" >