Skip to content

Commit

Permalink
fix: accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Feb 20, 2020
1 parent 462577f commit b657eb3
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
EuiBadge,
EuiCode,
EuiCodeBlock,
EuiScreenReaderOnly,
// @ts-ignore
EuiCodeEditor,
EuiDescribedFormGroup,
Expand Down Expand Up @@ -442,7 +443,7 @@ export class Field extends PureComponent<FieldProps> {
return null;
}

renderTitle(setting: FieldSetting) {
renderTitle(setting: FieldSetting, unsavedChanges: FieldState | undefined) {
return (
<h3>
{setting.displayName || setting.name}
Expand All @@ -463,6 +464,17 @@ export class Field extends PureComponent<FieldProps> {
) : (
''
)}
{unsavedChanges && (
<EuiScreenReaderOnly>
<p>
{unsavedChanges.error
? unsavedChanges.error
: i18n.translate('advancedSettings.field.settingIsUnsaved', {
defaultMessage: 'Setting is currently not saved.',
})}
</p>
</EuiScreenReaderOnly>
)}
</h3>
);
}
Expand Down Expand Up @@ -635,15 +647,8 @@ export class Field extends PureComponent<FieldProps> {

return (
<EuiDescribedFormGroup
aria-describedby={
unsavedChanges
? i18n.translate('advancedSettings.field.settingIsUnsaved', {
defaultMessage: 'Setting is currently not saved.',
})
: undefined
}
className={className}
title={this.renderTitle(setting)}
title={this.renderTitle(setting, unsavedChanges)}
description={this.renderDescription(setting)}
fullWidth
>
Expand Down

0 comments on commit b657eb3

Please sign in to comment.