From efde51e51387e5801e23701510b0238b5b324d60 Mon Sep 17 00:00:00 2001 From: "Y T. Hy" <52711139+yhy-1@users.noreply.github.com> Date: Fri, 9 Jun 2023 11:35:54 -0400 Subject: [PATCH 1/3] add aria-disabled and test --- cypress/fixtures/selectors.json | 1 + cypress/integration/single-select.spec.ts | 5 ++++- packages/react-select/src/components/Control.tsx | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cypress/fixtures/selectors.json b/cypress/fixtures/selectors.json index 9c6ecbdaba..da975f7e1c 100644 --- a/cypress/fixtures/selectors.json +++ b/cypress/fixtures/selectors.json @@ -10,6 +10,7 @@ "indicatorClear": ".react-select__clear-indicator", "indicatorDropdown": ".react-select__dropdown-indicator", "menu": ".react-select__menu", + "control": ".react-select__control", "menuOption": ".react-select__option", "noOptionsValue": ".react-select__menu-notice--no-options", "placeholder": ".react-select__placeholder", diff --git a/cypress/integration/single-select.spec.ts b/cypress/integration/single-select.spec.ts index d4700dc154..4583e0edea 100644 --- a/cypress/integration/single-select.spec.ts +++ b/cypress/integration/single-select.spec.ts @@ -107,7 +107,10 @@ describe('Single Select', () => { .click({ force: true }) .find('input') .should('exist') - .should('be.disabled'); + .should('be.disabled') + // control should have aria-disabled + .get(selector.control) + .should('have.a.property', 'aria-disabled', 'true'); }); it(`Should filter options when searching in view: ${viewport}`, () => { diff --git a/packages/react-select/src/components/Control.tsx b/packages/react-select/src/components/Control.tsx index d8e85c3db0..882390f9a4 100644 --- a/packages/react-select/src/components/Control.tsx +++ b/packages/react-select/src/components/Control.tsx @@ -87,6 +87,7 @@ const Control = < 'control--menu-is-open': menuIsOpen, })} {...innerProps} + aria-disabled={isDisabled || undefined} > {children} From 9e7db74cf4b9a08c078177a9d44a2fed24d3cf4c Mon Sep 17 00:00:00 2001 From: "Y T. Hy" <52711139+yhy-1@users.noreply.github.com> Date: Fri, 9 Jun 2023 13:10:37 -0400 Subject: [PATCH 2/3] Update single-select.spec.ts --- cypress/integration/single-select.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cypress/integration/single-select.spec.ts b/cypress/integration/single-select.spec.ts index 4583e0edea..2e7effeca5 100644 --- a/cypress/integration/single-select.spec.ts +++ b/cypress/integration/single-select.spec.ts @@ -109,8 +109,9 @@ describe('Single Select', () => { .should('exist') .should('be.disabled') // control should have aria-disabled - .get(selector.control) - .should('have.a.property', 'aria-disabled', 'true'); + .get(selector.singleBasicSelect) + .find(selector.control) + .should('have.attr', 'aria-disabled', 'true'); }); it(`Should filter options when searching in view: ${viewport}`, () => { From 2c80a323122d544f37e803320cd7011bfeec6a32 Mon Sep 17 00:00:00 2001 From: "Y T. Hy" <52711139+yhy-1@users.noreply.github.com> Date: Fri, 29 Sep 2023 11:11:09 -0400 Subject: [PATCH 3/3] add changeset --- .changeset/lemon-deers-taste.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lemon-deers-taste.md diff --git a/.changeset/lemon-deers-taste.md b/.changeset/lemon-deers-taste.md new file mode 100644 index 0000000000..30b9ac6404 --- /dev/null +++ b/.changeset/lemon-deers-taste.md @@ -0,0 +1,5 @@ +--- +'react-select': patch +--- + +Add aria-disabled to select's control component.