-
Couldn't load subscription status.
- Fork 1.6k
Redo accessibility for transcript #4108
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37ab40e to
40c93f0
Compare
67fd47e to
669bb64
Compare
cwhitten
approved these changes
Feb 10, 2022
This was referenced Mar 1, 2022
This was referenced Dec 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
role="feed"/role="article"for chat history and its messagesaria-activedescendantfor chat historyuseFocusanduseLocalizerDescription
Reworked our transcript (a.k.a. chat history) to resolve several issues related to accessibility experience.
<BasicTranscript>is one of our biggest codebase and it also grown organically huge.Adding a keyboard help screen
Similar to "Skip to content" accessible link, we are adding a keyboard help screen to better aid users to use our UI.
The help screen does not applies to mobile devices as these devices generally does not have arrow keys. To reduce confusion, we will hide the help screen when on mobile devices.
The help screen is the first UI to support light/dark theme, as long as high contrast mode (white-on-black).
Three different ways to read the activity
We reworked our chat history component to clearly identify 3 different ways to read messages:
aria-activedescendant)Wraparound interactive attachments
Yesterday, once focus is land inside the interactive attachment (e.g. Adaptive Cards), pressing TAB pass the last widget of the interactive attachment will focus back to the chat history. Pressing ESC will focus back to the chat history immediately.
Today, after focused inside the interactive attachment, TAB will wraparound until pressing ESC key. This is to align with other HTML elements such as
<audio controls>.role="feed"/role="article"Yesterday, we were using
<ul>/<li>for each activity (a.k.a. message bubble).Today, we are using
role="feed"androle="article". For a few reasons:role="feed"is designed for very long content and also support virtual scrolling viaaria-busy<ul>as it will push the content into second level, despitelist-style-type: noneis setrole="feed"/role="article"is designed to contain nested interactive elements, such as comment box, etc. This is more aligned to our Adaptive Cards and interactive attachment storyAlways have an activity as active, unless the chat history is empty
When the chat history is empty, regardless of whether the chat history is focused or not, we will assign an activity to
aria-activedescendantof the chat history. It will be default to the last activity.Updated verbiage
Yesterday, we refer to the message bubble area as "transcript".
Today, we refer to the message bubble area as "chat history".
Design
Keying activities
Yesterday, when identifying an individual activity, we need to use 2 different pieces of ID: client activity ID and activity ID. This makes our code complex as we often need to deal with two different IDs.
Today, we are keying activities by using a local permanent key. This key will unify both IDs as a unique key. However, this key is local to the browser instance (i.e. refresh on F5).
A new
<ActivityKeyer>component is added with several hooks for looking up activities and keys in different ways.Although we have exposed the React Hooks from this service, they are experimental and not documented. Their signatures may change without notices until we are satisfied with them.
Componentizing services for
<BasicTranscript>Yesterday, we put a lot of business logics inside
<BasicTranscript>. It organically grown into a file > 1,000 lines of code and very difficult to maintain.Today, we separate different business logics as services:
aria-activedescendantand descendant IDs for every activityaria-activedescendantmust point to one activity and the activity must be in the chat history, otherwise, default to the last activityHooks exposed by these services are experimental and not documented for now.
Tweaked bounding box of activities
Yesterday, when clicking on the very bottom edge of every message bubble. It may selected the next activity. This is because the bounding box of message bubbles overlaps with each other.
Today, we make sure the message bubbles are not overlap with each others.
Using
compute-scroll-into-viewpackageInstead of brewing our own calculations for
scrollIntoViewpolyfill, we are using the popularcompute-scroll-into-viewpackage, which has about 4M weekly downloads by now.Other smaller changes
useFocusanduseLocalizertypingsuseMemoWithPrevioushook for further optimizationuseMemo, sometimes, the array content could be exactly the sameuseMemofor arrays and they are cumbersomeconst value = useMemoWithPrevious((prevValue) => { ... }, [])makes it easier to look at previously memoized value to optimize memoizationfocusedActivitymeans chat history is focused, and the currently focusing activityactiveActivitymeans the currently activity set asaria-activedescendant, does not necessarily means the chat history is focusedgetActivityBoundingBoxesreturns the bounding boxes of activity DOM elements. They are designed for active descendant focus and is overlapping, so they could be scrolled into view perfectlySpecific Changes
Please see above.
CHANGELOG.mdReview Checklist
z-index)package.jsonandpackage-lock.jsonreviewedSecurity reviewed (no data URIs, check for nonce leak)