fix(form-core): improve validation feedback message for screen readers to make it one sentence (#2471)

This commit is contained in:
gerjanvangeest 2025-11-24 08:39:19 +01:00 committed by GitHub
parent 9a31b1a8db
commit 37b24e51ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 69 additions and 64 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/ui': patch
---
[form-core] improve validation feedback message for screen readers to make it one sentence.

View file

@ -87,11 +87,11 @@ export class LionValidationFeedback extends LocalizeMixin(LitElement) {
${this.feedbackData && ${this.feedbackData &&
this.feedbackData.map( this.feedbackData.map(
({ message, type, validator }) => html` ({ message, type, validator }) => html`
<div class="validation-feedback__type"> <span class="validation-feedback__type">
${message && type ${message && type
? this._localizeManager.msg(`lion-form-core:validation${capitalize(type)}`) ? this._localizeManager.msg(`lion-form-core:validation${capitalize(type)}`)
: nothing} : nothing}
</div> </span>
${this._messageTemplate({ message, type, validator })} ${this._messageTemplate({ message, type, validator })}
`, `,
)} )}

View file

@ -61,12 +61,12 @@ describe('lion-validation-feedback', () => {
await el.updateComplete; await el.updateComplete;
const validationFeedbackType = el.shadowRoot?.querySelector('.validation-feedback__type'); const validationFeedbackType = el.shadowRoot?.querySelector('.validation-feedback__type');
expect(validationFeedbackType?.textContent?.trim()).to.equal('Error'); expect(validationFeedbackType?.textContent?.trim()).to.equal('Error,');
el.feedbackData = [{ message: 'hello', type: 'info', validator: new AlwaysInvalid() }]; el.feedbackData = [{ message: 'hello', type: 'info', validator: new AlwaysInvalid() }];
await el.updateComplete; await el.updateComplete;
expect(validationFeedbackType?.textContent?.trim()).to.equal('Info'); expect(validationFeedbackType?.textContent?.trim()).to.equal('Info,');
}); });
it('it does not share the type if there is no message', async () => { it('it does not share the type if there is no message', async () => {

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Грешка', validationError: 'Грешка,',
validationWarning: 'Предупреждение', validationWarning: 'Предупреждение,',
validationSuccess: 'Успех', validationSuccess: 'Успех,',
validationInfo: 'Информация', validationInfo: 'Информация,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Chyba', validationError: 'Chyba,',
validationWarning: 'Varování', validationWarning: 'Varování,',
validationSuccess: 'Úspěch', validationSuccess: 'Úspěch,',
validationInfo: 'Informace', validationInfo: 'Informace,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Fehler', validationError: 'Fehler,',
validationWarning: 'Warnhinweis', validationWarning: 'Warnhinweis,',
validationSuccess: 'Erfolgreich', validationSuccess: 'Erfolgreich,',
validationInfo: 'Info', validationInfo: 'Info,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Error', validationError: 'Error,',
validationWarning: 'Warning', validationWarning: 'Warning,',
validationSuccess: 'Success', validationSuccess: 'Success,',
validationInfo: 'Info', validationInfo: 'Info,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Error', validationError: 'Error,',
validationWarning: 'Advertencia', validationWarning: 'Advertencia,',
validationSuccess: 'Satisfactorio', validationSuccess: 'Satisfactorio,',
validationInfo: 'Información', validationInfo: 'Información,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Erreur', validationError: 'Erreur,',
validationWarning: 'Avertissement', validationWarning: 'Avertissement,',
validationSuccess: 'Succès', validationSuccess: 'Succès,',
validationInfo: 'Info', validationInfo: 'Info,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Hiba', validationError: 'Hiba,',
validationWarning: 'Figyelmeztetés', validationWarning: 'Figyelmeztetés,',
validationSuccess: 'Sikeres', validationSuccess: 'Sikeres,',
validationInfo: 'Információ', validationInfo: 'Információ,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Errore', validationError: 'Errore,',
validationWarning: 'Avvertenza', validationWarning: 'Avvertenza,',
validationSuccess: 'Operazione riuscita', validationSuccess: 'Operazione riuscita,',
validationInfo: 'Info', validationInfo: 'Info,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Fout', validationError: 'Fout,',
validationWarning: 'Waarschuwing', validationWarning: 'Waarschuwing,',
validationSuccess: 'Succes', validationSuccess: 'Succes,',
validationInfo: 'Informatie', validationInfo: 'Informatie,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Błąd', validationError: 'Błąd,',
validationWarning: 'Ostrzeżenie', validationWarning: 'Ostrzeżenie,',
validationSuccess: 'Zrealizowano pomyślnie', validationSuccess: 'Zrealizowano pomyślnie,',
validationInfo: 'Informacja', validationInfo: 'Informacja,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Eroare', validationError: 'Eroare,',
validationWarning: 'Atenție', validationWarning: 'Atenție,',
validationSuccess: 'Succes', validationSuccess: 'Succes,',
validationInfo: 'Informații', validationInfo: 'Informații,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Ошибка', validationError: 'Ошибка,',
validationWarning: 'Предупреждение', validationWarning: 'Предупреждение,',
validationSuccess: 'Успешно', validationSuccess: 'Успешно,',
validationInfo: 'Информация', validationInfo: 'Информация,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Chyba', validationError: 'Chyba,',
validationWarning: 'Varovanie', validationWarning: 'Varovanie,',
validationSuccess: 'Úspešné', validationSuccess: 'Úspešné,',
validationInfo: 'Info', validationInfo: 'Info,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: 'Помилка', validationError: 'Помилка,',
validationWarning: 'Попередження', validationWarning: 'Попередження,',
validationSuccess: 'Успішно', validationSuccess: 'Успішно,',
validationInfo: 'Інформація', validationInfo: 'Інформація,',
}; };

View file

@ -1,6 +1,6 @@
export default { export default {
validationError: '错误', validationError: '错误',
validationWarning: '警告', validationWarning: '警告',
validationSuccess: '成功', validationSuccess: '成功',
validationInfo: '信息', validationInfo: '信息',
}; };