From e688f0c5600dcc9f3e17cdcd7721859aca6cbb86 Mon Sep 17 00:00:00 2001 From: Stephen Moring Date: Tue, 1 Mar 2022 16:03:52 -0500 Subject: [PATCH 1/2] updating aria-controls for combobox to have the value of itself or it's containing listbox based on whether the dropdown is open, also updating snapshots accordingly --- packages/react-select/src/Select.tsx | 2 +- .../src/__tests__/__snapshots__/Async.test.tsx.snap | 2 +- .../src/__tests__/__snapshots__/AsyncCreatable.test.tsx.snap | 2 +- .../src/__tests__/__snapshots__/Creatable.test.tsx.snap | 2 +- .../src/__tests__/__snapshots__/Select.test.tsx.snap | 2 +- .../src/__tests__/__snapshots__/StateManaged.test.tsx.snap | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-select/src/Select.tsx b/packages/react-select/src/Select.tsx index c9048a4ed0..1f7c568789 100644 --- a/packages/react-select/src/Select.tsx +++ b/packages/react-select/src/Select.tsx @@ -1558,7 +1558,7 @@ export default class Select< 'aria-autocomplete': 'list' as const, 'aria-expanded': menuIsOpen, 'aria-haspopup': true, - 'aria-controls': this.getElementId('listbox'), + 'aria-controls': menuIsOpen? this.getElementId('listbox') : this.getElementId('input'), 'aria-owns': this.getElementId('listbox'), 'aria-errormessage': this.props['aria-errormessage'], 'aria-invalid': this.props['aria-invalid'], diff --git a/packages/react-select/src/__tests__/__snapshots__/Async.test.tsx.snap b/packages/react-select/src/__tests__/__snapshots__/Async.test.tsx.snap index cac1b28d31..2b5752c6cf 100644 --- a/packages/react-select/src/__tests__/__snapshots__/Async.test.tsx.snap +++ b/packages/react-select/src/__tests__/__snapshots__/Async.test.tsx.snap @@ -193,7 +193,7 @@ exports[`defaults - snapshot 1`] = ` > snapshot 1`] = ` > Date: Tue, 1 Mar 2022 16:24:14 -0500 Subject: [PATCH 2/2] running prettier --- packages/react-select/src/Select.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-select/src/Select.tsx b/packages/react-select/src/Select.tsx index 1f7c568789..02fe1e8ac5 100644 --- a/packages/react-select/src/Select.tsx +++ b/packages/react-select/src/Select.tsx @@ -1558,7 +1558,9 @@ export default class Select< 'aria-autocomplete': 'list' as const, 'aria-expanded': menuIsOpen, 'aria-haspopup': true, - 'aria-controls': menuIsOpen? this.getElementId('listbox') : this.getElementId('input'), + 'aria-controls': menuIsOpen + ? this.getElementId('listbox') + : this.getElementId('input'), 'aria-owns': this.getElementId('listbox'), 'aria-errormessage': this.props['aria-errormessage'], 'aria-invalid': this.props['aria-invalid'],