-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Screen reader: support "do primary action" #4041
Merged
Merged
Conversation
This file contains 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
compulim
requested review from
a-b-r-o-w-n,
beyackle,
cwhitten,
srinaath,
tdurnford and
tonyanziano
as code owners
August 27, 2021 05:50
compulim
force-pushed
the
fix-4020-a11y-enter-key
branch
from
September 9, 2021 23:47
a82f6bd
to
49e389b
Compare
compulim
changed the title
[DRAFT] Screen reader: support "do primary action"
Screen reader: support "do primary action"
Sep 20, 2021
cwhitten
approved these changes
Sep 20, 2021
compulim
force-pushed
the
fix-4020-a11y-enter-key
branch
from
September 20, 2021 23:31
2a4ac46
to
f1e302b
Compare
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
Description
This pull request will resolve 2 accessibility issues:
Design
Capture ENTER while scan mode is enabled
When using screen reader with scan mode, the ENTER key will be captured by the screen reader and redirected as "do primary action". In browser term, it will send
click
event to the currently navigating element.The element may not be the physical focus (i.e. not represented by
document.activeElement
). Instead, the element could be a pseudo-focus and only know to the screen reader software (e.g. a blue box drawn by Windows Narrator).Although not well-documented, we found that when "do primary action" is triggered, the screen reader will:
click
event handler or notclick
event to that elementIn order to capture ENTER key while scan mode is enabled, we need to add an
onClick
handler to the activity. In additional to the currentonKeyDown
handler on the transcript.Alt text of suggested actions container is confusing
When the suggested actions were never shown, the screen reader navigating elements across the page may come across with "Suggested action container: Is empty".
The alt text was introduced because of an accessibility requirement. But it also created confusion to the user because they never encounter the suggested actions and don't know what to do.
When Web Chat is initially rendered, we could hide (not rendering) the suggested actions container. Thus, the alt text will never be read by the screen reader.
When the bot sent any suggested actions, we will start rendering the suggested actions container from that point of time. And the alt text "Suggested action container: Is empty" will be narrated by the screen reader afterward.
Specific Changes
<BasicTranscript>
focusInside()
function to focus on the inner of an interactive activityonClick
handler for interactive activity, this will serve as "primary action" for screen readeronKeyDown
handler will callfocusInside()
for a true ENTER key (not captured by screen reader)<SuggestedActions>
packages/directlinespeech/__tests__
temporarily disable tests related to "internal HTTP support", will re-enable in Re-enable Direct Line Speech "internal HTTP" tests #4053CHANGELOG.md
Review Checklist
CSS styles reviewed (minimal rules, noz-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)