Repository navigation
Separate link reference markers from the previous word for screen readers #5923
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
Draft
Eugene (OEvgeny)
wants to merge
3
commits into
main
Choose a base branch
from
OEvgeny/fix-citation-marker-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
74 changes: 74 additions & 0 deletions
74
__tests__/html2/accessibility/accessibleName.linkReference.html
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| <!doctype html> | ||
| <html lang="en-US"> | ||
| <head> | ||
| <link href="/assets/index.css" rel="stylesheet" type="text/css" /> | ||
| <!-- Shows the live region, so the snapshot shows the copy sent to screen readers. --> | ||
| <link href="/assets/accessibility.liveRegionAttachment.css" rel="stylesheet" type="text/css" /> | ||
| <script crossorigin="anonymous" src="/test-harness.js"></script> | ||
| <script crossorigin="anonymous" src="/test-page-object.js"></script> | ||
| <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script> | ||
| </head> | ||
| <body> | ||
| <main id="webchat"></main> | ||
| <script type="importmap"> | ||
| { | ||
| "imports": { | ||
| "@testduet/wait-for": "https://esm.sh/@testduet/wait-for" | ||
| } | ||
| } | ||
| </script> | ||
| <script type="module"> | ||
| import { waitFor } from '@testduet/wait-for'; | ||
|
|
||
| run(async function () { | ||
| const { directLine, store } = testHelpers.createDirectLineEmulator(); | ||
|
|
||
| WebChat.renderWebChat( | ||
| { | ||
| directLine, | ||
| store, | ||
| styleOptions: { hideSendBox: true, internalLiveRegionFadeAfter: 60000 } // Keep the live region content for the assertion and the snapshot. | ||
| }, | ||
| document.getElementById('webchat') | ||
| ); | ||
|
|
||
| await pageConditions.uiConnected(); | ||
|
|
||
| // GIVEN: a message with a link reference marker "[1]" right after a word, without a space. | ||
| await directLine.emulateIncomingActivity({ | ||
| text: 'Override the proxy settings[1].\n\n[1]: https://example.com/proxy "Proxy settings"', | ||
| type: 'message' | ||
| }); | ||
|
|
||
| await pageConditions.numActivitiesShown(1); | ||
|
|
||
| // THEN: the message's accessible name separates the marker from the word: "settings 1.", not "settings1.". | ||
| // Zero-width spaces wrap every link for line breaking, screen readers do not pause on them. | ||
| await waitFor(async () => | ||
| expect( | ||
| ( | ||
| await testHelpers.getAccessibleName( | ||
| pageElements.activities()[0].querySelector('.webchat__basic-transcript__activity-active-descendant') | ||
| ) | ||
| ).replace(/\u200b/gu, '') | ||
| ).toBe('Bot said: Override the proxy settings 1. One or more links in the message.') | ||
| ); | ||
|
|
||
| // THEN: the live region announces the same text on arrival. | ||
| await waitFor(() => | ||
| expect( | ||
| testHelpers | ||
| .getAllTextContents(pageElements.liveRegion()) | ||
| .join('\n') | ||
| .replace(/\u200b/gu, '') | ||
| ).toContain('Bot said:\nOverride the proxy settings 1.') | ||
| ); | ||
|
|
||
| await pageConditions.liveRegionStabilized(); | ||
|
|
||
| // THEN: the live region (top) shows "Override the proxy settings 1." with a space, while the transcript shows "settings[1].". | ||
| await host.snapshot('local'); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> | ||
Binary file added
BIN
+20.1 KB
__tests__/html2/accessibility/accessibleName.linkReference.html.snap-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: visualize the region via CSS override and take snapshot