Skip to content

Commit

Permalink
fix: lack of disabled attribute on select element causing color contr…
Browse files Browse the repository at this point in the history
…ast issue (#5666)
  • Loading branch information
yhy-1 authored Oct 2, 2023
1 parent d598ac6 commit 224a8f0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lemon-deers-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-select': patch
---

Add aria-disabled to select's control component.
1 change: 1 addition & 0 deletions cypress/fixtures/selectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion cypress/integration/single-select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ describe('Single Select', () => {
.click({ force: true })
.find('input')
.should('exist')
.should('be.disabled');
.should('be.disabled')
// control should have aria-disabled
.get(selector.singleBasicSelect)
.find(selector.control)
.should('have.attr', 'aria-disabled', 'true');
});

it(`Should filter options when searching in view: ${viewport}`, () => {
Expand Down
1 change: 1 addition & 0 deletions packages/react-select/src/components/Control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const Control = <
'control--menu-is-open': menuIsOpen,
})}
{...innerProps}
aria-disabled={isDisabled || undefined}
>
{children}
</div>
Expand Down

0 comments on commit 224a8f0

Please sign in to comment.