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

Screen reader should read alert when sending empty message or offline #4637

Merged
merged 5 commits into from
Feb 15, 2023

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Feb 10, 2023

Fixes #4623.

Changelog Entry

Fixed

  • Fixes #4623. Screen reader should read error when failed to send an empty message or offline, by @compulim in PR #4637

Description

When the user press ENTER or click on the "Send" button, while leaving the message empty or offline, Web Chat will not send the message.

However, we should also alert the user about their mistakes via screen reader.

This PR adds an alert when sending empty message or offline.

Design

We are adding an assertive live region inside the send box. It will hold the error message.

The error message will be triggered by three UIs: single line text box, multiline text area, and send button.

Since 3 different UIs need to show the error message, we are adding a new <SendBoxComposer> to handle the coordination. The new <SendBoxComposer> should also handle interactions related to the send box.

However, due to time constraints, we cannot fully complete the <SendBoxComposer>. We will complete it when we are working on the customizable send box work (#1839).

Specific Changes

  • Added a new <SendBoxComposer>
    • It includes an assertive live region, which can be repetitively read error messages
  • Moved submit logic from send button and text box submit, into the new useSubmit() hook exposed by the new <SendBoxComposer>
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@compulim compulim marked this pull request as ready for review February 13, 2023 16:28
Copy link
Contributor

@beyackle2 beyackle2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, but I have some small suggestions.

Co-authored-by: Benjamin Yackley <113474767+beyackle2@users.noreply.github.com>
@compulim compulim merged commit f856b83 into main Feb 15, 2023
@compulim compulim deleted the feat-alert-on-empty-sendbox branch February 15, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants