Repository navigation
Do not set role="figure" on unlabelled Adaptive Cards, and show a pointer on clickable elements #5915
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
Open
Eugene (OEvgeny)
wants to merge
5
commits into
main
Choose a base branch
from
OEvgeny/fix-ac-selectable-figure
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.
+118
−3
Open
Do not set role="figure" on unlabelled Adaptive Cards, and show a pointer on clickable elements #5915
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9d33e1f
Do not set role="figure" on Adaptive Cards without a label
a7af10c
Show a pointer cursor on clickable Adaptive Card elements
79ff88f
Add PR number to changelog
8efe2f6
Show the live region copy in role mod snapshots
65ed889
Give the second card in hack.roleMod.html a distinct speak
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
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
Binary file added
BIN
+21.1 KB
__tests__/html2/accessibility/adaptiveCard/hack.roleMod.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.
92 changes: 92 additions & 0 deletions
92
__tests__/html2/accessibility/adaptiveCard/hack.roleMod.unlabelled.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,92 @@ | ||
| <!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(); | ||
|
|
||
| // GIVEN: Web Chat keeps the live region copy of new messages, so it can be seen in the snapshot. | ||
| WebChat.renderWebChat( | ||
| { directLine, store, styleOptions: { hideSendBox: true, internalLiveRegionFadeAfter: 60000 } }, | ||
| document.getElementById('webchat') | ||
| ); | ||
|
|
||
| await pageConditions.uiConnected(); | ||
|
|
||
| // WHEN: Bot sends 2 Adaptive Cards without "speak", so the card has no label: one without inputs and one with inputs. | ||
| await directLine.emulateIncomingActivity({ | ||
| attachments: [ | ||
| { | ||
| content: { | ||
| $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', | ||
| body: [{ text: 'Sunny, 21°C', type: 'TextBlock' }], | ||
| type: 'AdaptiveCard', | ||
| version: '1.5' | ||
| }, | ||
| contentType: 'application/vnd.microsoft.card.adaptive' | ||
| }, | ||
| { | ||
| content: { | ||
| $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', | ||
| actions: [{ title: 'Submit', type: 'Action.Submit' }], | ||
| body: [ | ||
| { | ||
| id: 'name', | ||
| label: 'What is your full name', | ||
| placeholder: 'For example, John Doe', // The live region copy names inputs by their placeholder until #5913 (by their label). | ||
| type: 'Input.Text' | ||
| } | ||
| ], | ||
| type: 'AdaptiveCard', | ||
| version: '1.5' | ||
| }, | ||
| contentType: 'application/vnd.microsoft.card.adaptive' | ||
| } | ||
| ], | ||
| type: 'message' | ||
| }); | ||
|
|
||
| await pageConditions.numActivitiesShown(1); | ||
| await waitFor(() => expect(document.querySelectorAll('.ac-adaptiveCard')).toHaveLength(2)); | ||
|
|
||
| const cardElements = Array.from(document.querySelectorAll('.ac-adaptiveCard')); | ||
|
|
||
| // THEN: Both cards should have no label. | ||
| expect(cardElements.map(cardElement => cardElement.getAttribute('aria-label'))).toEqual([null, null]); | ||
|
|
||
| // THEN: Both cards should have no role, as "figure" and "form" without a name are announced without their content. | ||
| expect(cardElements.map(cardElement => cardElement.getAttribute('role'))).toEqual([null, null]); | ||
|
|
||
| // THEN: Neither card should be a "figure" or a "form" in the accessibility tree. | ||
| expect( | ||
| (await Promise.all(cardElements.map(cardElement => testHelpers.getAccessibilityNode(cardElement)))).map( | ||
| ({ role }) => role?.value | ||
| ) | ||
| ).toEqual(['generic', 'generic']); | ||
|
|
||
| await pageConditions.liveRegionStabilized(); | ||
|
|
||
| // THEN: The live region shows what screen readers announce: "Bot said:", "A card:" for each card, then the input and the "Submit" button of the second card. | ||
| await host.snapshot('local'); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
Binary file added
BIN
+19.5 KB
__tests__/html2/accessibility/adaptiveCard/hack.roleMod.unlabelled.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
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.
Uh oh!
There was an error while loading. Please reload this page.