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

Add typing indicator to live region #4210

Merged
merged 3 commits into from
Apr 12, 2022

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Mar 24, 2022

Fixes #4099.

Changelog Entry

Added

  • Resolves #4099, added typing indicator to live region for screen reader, by @compulim, in PR #4210

Description

When receiving a typing activity, screen reader should narrate "Bot is typing."

Design

Who is typing

Depends on which participant send the typing activity, it could be "Bot is typing" or "John is typing".

Direct Line activity do have a field from.name to indicate the name of the sender. However, Direct Line does not return a friendly bot name and we need to patch it.

If all of the condition is true, we will change the activity.from.name to "Bot":

  • activity.channelData is "directline" or "webchat", and;
  • activity.from.role is "bot", and;
  • activity.from.id is the same as activity.from.name.

When more than one participant is typing, the typing indicator will be read as "John and others are typing."

Incorrect at field returned by useActiveTyping()

Previously, in our HOOKS.md, we stated:

This hook will return a list of participants who are actively typing, including the start typing time (at) and expiration time (expireAt), the name and the role of the participant.

However, when we revisit the code, the at field actually indicate the timestamp of most recent typing activity, instead of the starting time.

We fixed this by correcting the at field.

Specific Changes

  • Updated core/src/reducers/typing.js for correcting the at field, it should be based on
  • Updated HOOKS.md to indicate the issue <= 4.15.1
  • Updated <LiveRegionTwin> to narrate static text properly (aria-labelledby is required by some browsers)
  • Added sender name patch logic for "directline" and "webchat" channel
  • Added new string "$1 is typing" and "$1 and others are typing" to en-US.json
  • 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 March 24, 2022 20:30
@compulim compulim added the p1 Painful if we don't fix, won't block releasing label Mar 24, 2022
cwhitten
cwhitten previously approved these changes Mar 24, 2022
cwhitten
cwhitten previously approved these changes Apr 7, 2022
@compulim compulim merged commit af6e8a3 into microsoft:main Apr 12, 2022
@compulim compulim deleted the feat-read-typing-indicator branch April 12, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 Painful if we don't fix, won't block releasing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Accessibility] [Omnichannel] Screen reader is not notifying the user when the agent is typing
2 participants