Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
[terra-native-select] Reverted Changes to announce selected state. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
saket2403 authored Jan 9, 2024
1 parent 8e82cb1 commit f173dd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
3 changes: 3 additions & 0 deletions packages/terra-form-select/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Reverted changes to announce selected state in `native-select`.

## 6.53.1 - (January 4, 2024)

* Fixed
Expand Down
16 changes: 1 addition & 15 deletions packages/terra-form-select/src/native-select/NativeSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,23 +216,9 @@ const NativeSelect = ({
currentValue = getFirstValue(options, isFilterStyle);
currentDisplay = getDisplay(currentValue, options, isFilterStyle, intl);
}
const groupHeading = options.filter(groupValue => (groupValue.options)).find(element => element.options.find(childElement => childElement.value === currentValue));

const selectedText = intl.formatMessage({ id: 'Terra.form.select.selected' });

let displayText;
if (currentValue) {
if (groupHeading) {
displayText = intl.formatMessage({ id: 'Terra.form.select.optGroup' }, { text: `${groupHeading.display}, ${ariaLabel}, ${selectedText}` });
} else {
displayText = `${ariaLabel}, ${selectedText}`;
}
} else {
displayText = ariaLabel;
}
const selectAttrs = {
'aria-describedby': ariaDescribedBy,
'aria-label': displayText,
'aria-label': ariaLabel,
id,
disabled,
'aria-invalid': isInvalid || undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,7 @@ exports[`NativeSelect should render a NativeSelect with options and defaultValue
</div>
</div>
<select
aria-label="test-label, Terra.form.select.selected"
aria-label="test-label"
className="select"
disabled={false}
onBlur={[Function]}
Expand Down Expand Up @@ -1898,7 +1898,7 @@ exports[`NativeSelect should render a NativeSelect with options and value 1`] =
</div>
</div>
<select
aria-label="test-label, Terra.form.select.selected"
aria-label="test-label"
className="select"
disabled={false}
onBlur={[Function]}
Expand Down

0 comments on commit f173dd7

Please sign in to comment.