timolins / react-hot-toast

Smoking Hot React Notifications 🔥
https://react-hot-toast.com
MIT License
9.84k stars 331 forks source link

(Suggestion) Enhancing Web Accessibility #336

Open wherehows opened 10 months ago

wherehows commented 10 months ago

For better accessibility, the current design involves passing aria-role and aria-live through ariaProps. However, since aria-role already functions as aria-live, it could be beneficial to eliminate ariaProps and structure it to allow passing only ariaRole as a toast option.

Furthermore, referencing MDN reveals a potential double-speaking issue when assigning "alert" to aria-role and "assertive" to aria-live. To address this, it is recommended to set aria-live to "polite" for compatibility when aria-role is "status." Conversely, when aria-role is "alert," it is advisable not to assign a separate aria-live. Consider integrating these considerations into the code.

For more information on the aforementioned points, you can refer to ARIA live regions - Accessibility | MDN.