From f856b8375c5fda8113f18d28946e8c3539518064 Mon Sep 17 00:00:00 2001 From: William Wong Date: Wed, 15 Feb 2023 12:19:00 -0800 Subject: [PATCH] Screen reader should read alert when sending empty message or offline (#4637) * Alert when sending empty message * Add offline error * Fix tests * Cosmetics * Apply suggestions from code review Co-authored-by: Benjamin Yackley <113474767+beyackle2@users.noreply.github.com> --------- Co-authored-by: Benjamin Yackley <113474767+beyackle2@users.noreply.github.com> --- CHANGELOG.md | 2 +- ...rtEmptyMessage.multilineTextBox.enter.html | 56 +++++++ ...lertEmptyMessage.multilineTextBox.enter.js | 6 + ....sendBox.alertEmptyMessage.sendButton.html | 67 ++++++++ ...ty.sendBox.alertEmptyMessage.sendButton.js | 6 + ...tEmptyMessage.singleLineTextBox.enter.html | 53 +++++++ ...ertEmptyMessage.singleLineTextBox.enter.js | 6 + ...ility.sendBox.alertOffline.sendButton.html | 53 +++++++ ...ibility.sendBox.alertOffline.sendButton.js | 6 + __tests__/html/useTextBoxSubmit.true.html | 46 ------ __tests__/html/useTextBoxSubmit.true.js | 3 - packages/component/package-lock.json | 102 +++++------- packages/component/package.json | 3 +- packages/component/src/BasicSendBox.tsx | 7 +- packages/component/src/Composer.tsx | 8 +- .../src/SendBox/AutoResizeTextArea.tsx | 5 + packages/component/src/SendBox/SendButton.tsx | 21 +-- packages/component/src/SendBox/TextBox.tsx | 54 +++---- .../src/Utils/AccessibleInputText.tsx | 5 + .../internal/SendBox/SendBoxComposer.tsx | 150 ++++++++++++++++++ .../internal/SendBox/private/Context.ts | 7 + .../internal/SendBox/private/types.ts | 6 + .../internal/SendBox/private/useContext.ts | 15 ++ .../internal/SendBox/useErrorMessageId.ts | 15 ++ .../providers/internal/SendBox/useSubmit.ts | 17 ++ packages/core/src/sagas/submitSendBoxSaga.js | 3 + .../globals/pageElements/sendBoxTextBox.js | 2 +- .../testHelpers/createDirectLineEmulator.js | 10 +- 28 files changed, 575 insertions(+), 159 deletions(-) create mode 100644 __tests__/html/accessibility.sendBox.alertEmptyMessage.multilineTextBox.enter.html create mode 100644 __tests__/html/accessibility.sendBox.alertEmptyMessage.multilineTextBox.enter.js create mode 100644 __tests__/html/accessibility.sendBox.alertEmptyMessage.sendButton.html create mode 100644 __tests__/html/accessibility.sendBox.alertEmptyMessage.sendButton.js create mode 100644 __tests__/html/accessibility.sendBox.alertEmptyMessage.singleLineTextBox.enter.html create mode 100644 __tests__/html/accessibility.sendBox.alertEmptyMessage.singleLineTextBox.enter.js create mode 100644 __tests__/html/accessibility.sendBox.alertOffline.sendButton.html create mode 100644 __tests__/html/accessibility.sendBox.alertOffline.sendButton.js delete mode 100644 __tests__/html/useTextBoxSubmit.true.html delete mode 100644 __tests__/html/useTextBoxSubmit.true.js create mode 100644 packages/component/src/providers/internal/SendBox/SendBoxComposer.tsx create mode 100644 packages/component/src/providers/internal/SendBox/private/Context.ts create mode 100644 packages/component/src/providers/internal/SendBox/private/types.ts create mode 100644 packages/component/src/providers/internal/SendBox/private/useContext.ts create mode 100644 packages/component/src/providers/internal/SendBox/useErrorMessageId.ts create mode 100644 packages/component/src/providers/internal/SendBox/useSubmit.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index feca5173af..f4f25600b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Added function to emit status change telemetry event for activities, by [@Erli-ms](https://github.com/Erli-ms), in PR [#4631](https://github.com/microsoft/BotFramework-WebChat/pull/4631) - - Added ability for developers to customize Web Chat by extending the default UI without having to re-implement existing components, by [@dawolff-ms](https://github.com/dawolff-ms), in PR [#4539](https://github.com/microsoft/BotFramework-WebChat/pull/4539) ### Fixed @@ -34,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixes [#4566](https://github.com/microsoft/BotFramework-WebChat/issues/4566). For YouTube and Vimeo `