apvarun / toastify-js

Pure JavaScript library for better notification messages
https://apvarun.github.io/toastify-js/
MIT License
2.09k stars 230 forks source link

Improve accessibility by defaulting and allowing `aria-live` #105

Closed nickvergessen closed 2 years ago

nickvergessen commented 2 years ago

Hi there, greetings from https://github.com/nextcloud/nextcloud-dialogs/issues/255 We are in the process of doing an A11y validation and one of the remarks was that or errors and messages (which are using toastify) are not read by screen readers. This can be easily achieved by setting aria-live="polite" on the HTMLElement.

For errors and important information it is even recommended to use aria-live="assertive", however this interrupts whatever is currently being read out by the screenreader, so it should be "opt in" so it can be used for errors and similar stuff, but is not forced for "Your message was posted" kind of messages.

Currently I implemented a PR in our lib which just manipulates the HTMLElement afterwards: https://github.com/nextcloud/nextcloud-dialogs/pull/622/files

But of course it would be better if the library would allow this directly, so all users of the lib benefit from it.

Are you interested in fixing this and would accept a pull request + publish a new version afterwards?

apvarun commented 2 years ago

Hi @nickvergessen This is some good stuff. Please do send in a PR for the same. I'll be happy to publish a new version afterwards.

nickvergessen commented 2 years ago

Patch in https://github.com/apvarun/toastify-js/pull/106

apvarun commented 2 years ago

@nickvergessen New Release v1.12.0 is up