Skip to content

Commit f768e17

Browse files
Michael JordanLFDanLu
andauthored
fix(#2621): ActionGroup with overflowMode: collapse: ActionMenu button should not receive aria-checked (#2622)
Co-authored-by: Daniel Lu <[email protected]>
1 parent 66414f9 commit f768e17

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/@react-spectrum/actiongroup/src/ActionGroup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ function ActionGroupMenu<T>({state, isDisabled, isEmphasized, staticColor, items
369369
// The menu button shouldn't act like an actual action group item.
370370
delete buttonProps.onPress;
371371
delete buttonProps.role;
372+
delete buttonProps['aria-checked'];
372373

373374
let {hoverProps, isHovered} = useHover({isDisabled});
374375

packages/@react-spectrum/actiongroup/test/ActionGroup.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ describe('ActionGroup', function () {
717717
expect(buttons[0]).toHaveTextContent('One');
718718
expect(buttons[1]).toHaveAttribute('aria-label', '…');
719719
expect(buttons[1]).toHaveAttribute('aria-haspopup', 'true');
720+
expect(buttons[1]).not.toHaveAttribute('aria-checked');
720721

721722
triggerPress(buttons[1]);
722723

@@ -784,6 +785,7 @@ describe('ActionGroup', function () {
784785
let button = tree.getByRole('button');
785786
expect(button).toHaveAttribute('aria-label', 'Test');
786787
expect(button).toHaveAttribute('aria-haspopup', 'true');
788+
expect(button).not.toHaveAttribute('aria-checked');
787789

788790
triggerPress(button);
789791

@@ -817,6 +819,7 @@ describe('ActionGroup', function () {
817819
let button = tree.getByRole('button');
818820
expect(button).toHaveAttribute('aria-label', '…');
819821
expect(button).toHaveAttribute('aria-haspopup', 'true');
822+
expect(button).not.toHaveAttribute('aria-checked');
820823

821824
triggerPress(button);
822825

@@ -859,6 +862,7 @@ describe('ActionGroup', function () {
859862
let button = tree.getByRole('button');
860863
expect(button).toHaveAttribute('aria-label', '…');
861864
expect(button).toHaveAttribute('aria-haspopup', 'true');
865+
expect(button).not.toHaveAttribute('aria-checked');
862866

863867
triggerPress(button);
864868

@@ -903,6 +907,7 @@ describe('ActionGroup', function () {
903907
expect(buttons[0]).toBeDisabled();
904908
expect(buttons[1]).toHaveAttribute('aria-label', '…');
905909
expect(buttons[1]).toHaveAttribute('aria-haspopup', 'true');
910+
expect(buttons[1]).not.toHaveAttribute('aria-checked');
906911
expect(buttons[1]).toBeDisabled();
907912
});
908913

@@ -925,6 +930,7 @@ describe('ActionGroup', function () {
925930
expect(within(actionGroup).getByRole('button', {name: 'One'})).toBeVisible();
926931

927932
const moreButton = within(actionGroup).getByRole('button', {name: '…'});
933+
expect(moreButton).not.toHaveAttribute('aria-checked');
928934
expect(moreButton).toBeVisible();
929935

930936
triggerPress(moreButton);

0 commit comments

Comments
 (0)