Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spike] - Research the use of Toast in React Aria Components as a possible source for "flash messages" #211

Open
jupiter007 opened this issue Dec 17, 2024 · 3 comments
Assignees

Comments

@jupiter007
Copy link
Collaborator

We need a way to message users to give them feedback when they interact with the page, like clicking "Archive Template" or "Save as Draft" to let them know that it succeeded or failed.

Flash messages are a possible solution. Fraser suggested "Toast" as a possible solution since it's included within React Aria Components, but we are uncertain about whether it meets accessibility requirements. Also, we're wondering what the implementation is like, and how it compares to either creating our own custom solution.

@jupiter007 jupiter007 self-assigned this Dec 17, 2024
@jupiter007
Copy link
Collaborator Author

jupiter007 commented Dec 21, 2024

So far, i tested out react-toastify which is the most popular toast messaging package. It worked, and was easy to style. The messages have a role=alert for screen readers, and also a close button to allow users to close. I was reading about role-alert here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role, and it seems that this might be sufficient to make the flash messages accessible.

I started reading about React Aria's "useToast" here: https://react-spectrum.adobe.com/react-aria/useToast.html. It's much more complicated, but it might add additional accessibility for screen readers. I will research that next.

@bofstein
Copy link
Collaborator

bofstein commented Jan 6, 2025

Going to demo on 1/7/25, see what's needed after

@jupiter007
Copy link
Collaborator Author

jupiter007 commented Jan 7, 2025

We should make updates so that:

  • We position toast messages differently per device (mobile should include toast message at bottom of page, and desktop at the top, below the header)
  • We can pass keys for (info, warning and error) to style the background colors.
  • we can control widths of messages based on device
  • Add toast messages to styleguide

Is there a built-in scroll to the toast message when it is displayed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants