Skip to content

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
@compulim compulim force-pushed the feat-alert-on-empty-sendbox branch from 3dca497 to bba795c Compare February 14, 2023 23:44
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

Development

Successfully merging this pull request may close these issues.

Error message is not displayed after clicking ‘Send’ button on without entering value in 'Send a message' edit field.

3 participants