From 708497200fe290c09f907a69f90cc198a4318c89 Mon Sep 17 00:00:00 2001 From: Sarah Higley Date: Mon, 30 Dec 2024 15:41:41 -0800 Subject: [PATCH 1/2] fix: add aria-disabled to expand button --- .../src/components/TagPicker/TagPicker.test.tsx | 14 ++++++++++++++ .../TagPickerControl/useTagPickerControl.tsx | 1 + 2 files changed, 15 insertions(+) diff --git a/packages/react-components/react-tag-picker/library/src/components/TagPicker/TagPicker.test.tsx b/packages/react-components/react-tag-picker/library/src/components/TagPicker/TagPicker.test.tsx index 62ad196a8c26b..070c27e7c93cd 100644 --- a/packages/react-components/react-tag-picker/library/src/components/TagPicker/TagPicker.test.tsx +++ b/packages/react-components/react-tag-picker/library/src/components/TagPicker/TagPicker.test.tsx @@ -62,4 +62,18 @@ describe('TagPicker', () => { const expandButton = getByRole('button'); expect(expandButton.getAttribute('aria-labelledby')).toContain('Selected Employees'); }); + + it('sets expand button to disabled when TagPicker is disabled', () => { + const { getByRole } = render( + + + + + + , + ); + + const expandButton = getByRole('button'); + expect(expandButton.getAttribute('aria-disabled')).toEqual('true'); + }); }); diff --git a/packages/react-components/react-tag-picker/library/src/components/TagPickerControl/useTagPickerControl.tsx b/packages/react-components/react-tag-picker/library/src/components/TagPickerControl/useTagPickerControl.tsx index 9a684d8ff3577..0e1ae1048c6fc 100644 --- a/packages/react-components/react-tag-picker/library/src/components/TagPickerControl/useTagPickerControl.tsx +++ b/packages/react-components/react-tag-picker/library/src/components/TagPickerControl/useTagPickerControl.tsx @@ -61,6 +61,7 @@ export const useTagPickerControl_unstable = ( renderByDefault: !noPopover, defaultProps: { 'aria-expanded': open, + 'aria-disabled': disabled ? 'true' : undefined, children: , role: 'button', }, From 13e8f35202bc10c2563dc49a373bc9221f439da0 Mon Sep 17 00:00:00 2001 From: Sarah Higley Date: Mon, 30 Dec 2024 15:45:54 -0800 Subject: [PATCH 2/2] change file --- ...ct-tag-picker-81e8253d-652a-423d-bd38-2f4ee36719cb.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-tag-picker-81e8253d-652a-423d-bd38-2f4ee36719cb.json diff --git a/change/@fluentui-react-tag-picker-81e8253d-652a-423d-bd38-2f4ee36719cb.json b/change/@fluentui-react-tag-picker-81e8253d-652a-423d-bd38-2f4ee36719cb.json new file mode 100644 index 0000000000000..be46fc4ddfe8f --- /dev/null +++ b/change/@fluentui-react-tag-picker-81e8253d-652a-423d-bd38-2f4ee36719cb.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix: add aria-disabled to expand button when disabled", + "packageName": "@fluentui/react-tag-picker", + "email": "sarah.higley@microsoft.com", + "dependentChangeType": "patch" +}