Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(FilterableMultiSelect): ariaLabel to aria-label #13276

Merged
merged 5 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 @@ -357,6 +358,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 @@ -483,9 +485,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 @@ -628,7 +639,7 @@ FilterableMultiSelect.propTypes = {
};

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