Skip to content

Commit

Permalink
refactor(FilterableMultiSelect): ariaLabel to aria-label (#13276)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrea N. Cardona <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: TJ Egan <[email protected]>
  • Loading branch information
4 people authored Mar 6, 2023
1 parent ebd6ea5 commit b4d3e74
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
10 changes: 6 additions & 4 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3296,7 +3296,7 @@ Map {
"FilterableMultiSelect" => Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"ariaLabel": "Choose an item",
"aria-label": "Choose an item",
"compareItems": [Function],
"direction": "bottom",
"disabled": false,
Expand All @@ -3309,9 +3309,10 @@ Map {
"sortItems": [Function],
},
"propTypes": Object {
"ariaLabel": Object {
"aria-label": Object {
"type": "string",
},
"ariaLabel": [Function],
"compareItems": Object {
"isRequired": true,
"type": "func",
Expand Down Expand Up @@ -4536,7 +4537,7 @@ Map {
"Filterable": Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"ariaLabel": "Choose an item",
"aria-label": "Choose an item",
"compareItems": [Function],
"direction": "bottom",
"disabled": false,
Expand All @@ -4549,9 +4550,10 @@ Map {
"sortItems": [Function],
},
"propTypes": Object {
"ariaLabel": Object {
"aria-label": Object {
"type": "string",
},
"ariaLabel": [Function],
"compareItems": Object {
"isRequired": true,
"type": "func",
Expand Down
19 changes: 15 additions & 4 deletions packages/react/src/components/MultiSelect/FilterableMultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import { FormContext } from '../FluidForm';

const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect(
{
ariaLabel,
['aria-label']: ariaLabel,
ariaLabel: deprecatedAriaLabel,
className: containerClassName,
compareItems,
direction,
Expand Down Expand Up @@ -361,6 +362,7 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect(
</label>
) : null}
<ListBox
aria-label={deprecatedAriaLabel || ariaLabel}
onFocus={isFluid ? handleFocus : null}
onBlur={isFluid ? handleFocus : null}
className={className}
Expand Down Expand Up @@ -487,9 +489,18 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect(

FilterableMultiSelect.propTypes = {
/**
* 'aria-label' of the ListBox component.
* Specify a label to be read by screen readers on the container node
*/
ariaLabel: PropTypes.string,
['aria-label']: PropTypes.string,

/**
* Deprecated, please use `aria-label` instead.
* Specify a label to be read by screen readers on the container note.
*/
ariaLabel: deprecate(
PropTypes.string,
'This prop syntax has been deprecated. Please use the new `aria-label`.'
),

/**
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
Expand Down Expand Up @@ -632,7 +643,7 @@ FilterableMultiSelect.propTypes = {
};

FilterableMultiSelect.defaultProps = {
ariaLabel: 'Choose an item',
['aria-label']: 'Choose an item',
compareItems: defaultCompareItems,
direction: 'bottom',
disabled: false,
Expand Down

0 comments on commit b4d3e74

Please sign in to comment.