Merge pull request #1533 from jsit/fix/add-aria-describedby-lang-warn

fix: Add aria-describedby for language warning
This commit is contained in:
SleeplessOne1917 2023-06-23 21:37:48 +00:00 committed by GitHub
commit 6af04f1f7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,13 +49,7 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
return this.props.iconVersion ? (
this.selectBtn
) : (
<div className="language-select">
{this.props.multiple && this.props.showLanguageWarning && (
<div className="alert alert-warning" role="alert">
{I18NextService.i18n.t("undetermined_language_warning")}
</div>
)}
<div className="mb-3 row">
<div className="language-select mb-3">
<label
className={classNames(
"col-form-label",
@ -67,6 +61,15 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
this.props.multiple ? "language_plural" : "language"
)}
</label>
{this.props.multiple && this.props.showLanguageWarning && (
<div
id="lang-warning"
className="alert small alert-warning"
role="alert"
>
{I18NextService.i18n.t("undetermined_language_warning")}
</div>
)}
<div
className={classNames(`col-sm-${this.props.multiple ? 9 : 10}`, {
"input-group": this.props.multiple,
@ -83,7 +86,6 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
)}
</div>
</div>
</div>
);
}
@ -105,6 +107,11 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
id={this.id}
onChange={linkEvent(this, this.handleLanguageChange)}
aria-label={I18NextService.i18n.t("language_select_placeholder")}
aria-describedby={
this.props.multiple && this.props.showLanguageWarning
? "lang-warning"
: ""
}
multiple={this.props.multiple}
disabled={this.props.disabled}
>