Screen reader should read alert when sending empty message or offline #4637
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog Entry
Fixed
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
<SendBoxComposer>
useSubmit()
hook exposed by the new<SendBoxComposer>
CHANGELOG.md
Review Checklist
Browser and platform compatibilities reviewedz-index
)Documents reviewed (docs, samples, live demo)Internationalization reviewed (strings, unit formatting)package.json
andpackage-lock.json
reviewedSecurity reviewed (no data URIs, check for nonce leak)