overleaf/services/web/app/views/_mixins/formMessages.pug
June Kelly 5141f7b452 Merge pull request #5199 from overleaf/jk-de-ng-form-messages-role
[web] Improve a11y of form-messages

GitOrigin-RevId: 36360bc188f9a582e891d50328a6f27b414dce2a
2021-09-27 08:03:10 +00:00

31 lines
542 B
Text

mixin formMessages()
div(
data-ol-form-messages='',
role="alert"
)
mixin customFormMessage(key, kind)
if kind === 'success'
div.alert.alert-success(
hidden,
data-ol-custom-form-message=key,
role="alert"
aria-live="polite"
)
block
else if kind === 'danger'
div.alert.alert-danger(
hidden,
data-ol-custom-form-message=key,
role="alert"
aria-live="assertive"
)
block
else
div.alert.alert-warning(
hidden,
data-ol-custom-form-message=key,
role="alert"
aria-live="polite"
)
block