-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set default descendant when focusing on transcript and add keyboard f…
…ocus indicators (#4035) * Set default active descendant * Update to TypeScript * Add JSDoc * Update entry * Fix and clean up on focus activity * Add capability detection * Clean up * Clean up * Fix test * Fix tests * Fix tests * Fix tests * Clean up * Fix tests * Fix tests * Fix tests * Fix test * Add tests * Clean up * Fix typing for `usePerformCardAction` hook (#3969) * Fix typing for usePerformCardAction * Update entry * Fix ESLint * Fix ESLint * Clean up * Clean up * Add new focus indicator for suggested actions * Styling send box button with accessibility * Clean up * Add snapshots * Add entries * Typo * Fix color * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Improve test reliability * Improve test reliability: wait for render * Fix test reliability * Improve test reliability * Improve test reliability * Fix typings * Fix focusedActivityKey after merge
- Loading branch information
Showing
139 changed files
with
2,861 additions
and
561 deletions.
There are no files selected for viewing
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
Binary file modified
BIN
+232 Bytes
(100%)
...mage_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-34.6 KB
...ottom-if-submitting-an-adaptive-card-while-suggested-actions-is-open-1-snap.png
Binary file not shown.
Binary file modified
BIN
+1.32 KB
(100%)
...oll-to-bottom-js-show-new-messages-button-only-when-new-message-come-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34.5 KB
...-actions-shown-should-stick-to-bottom-if-submitting-an-adaptive-card-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+227 Bytes
(100%)
...ould-not-move-after-adaptive-card-is-disable-after-manually-disabled-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+230 Bytes
(100%)
...ould-not-move-after-adaptive-card-is-disable-after-manually-disabled-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+198 Bytes
(100%)
...ocus-management-focus-should-not-move-after-the-whole-ui-is-disabled-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+221 Bytes
(100%)
...ocus-management-focus-should-not-move-after-the-whole-ui-is-disabled-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-61 Bytes
(100%)
...shots__/html/hooks-use-text-box-js-use-text-box-should-work-properly-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-54 Bytes
(100%)
...shots__/html/hooks-use-text-box-js-use-text-box-should-work-properly-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.85 KB
...x-button-style-options-js-send-box-button-with-default-style-options-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.05 KB
...x-button-style-options-js-send-box-button-with-default-style-options-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.91 KB
...x-button-style-options-js-send-box-button-with-default-style-options-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.12 KB
...x-button-style-options-js-send-box-button-with-default-style-options-4-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.15 KB
...x-button-style-options-js-send-box-button-with-default-style-options-5-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.01 KB
...button-style-options-js-send-box-button-with-different-style-options-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.92 KB
...button-style-options-js-send-box-button-with-different-style-options-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...button-style-options-js-send-box-button-with-different-style-options-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.64 KB
...button-style-options-js-send-box-button-with-different-style-options-4-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.68 KB
...button-style-options-js-send-box-button-with-different-style-options-5-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.46 KB
(110%)
...access-key-js-suggested-actions-should-be-focusable-using-access-key-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-83 Bytes
(100%)
...access-key-js-suggested-actions-should-be-focusable-using-access-key-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-31 Bytes
(100%)
...access-key-js-suggested-actions-should-be-focusable-using-access-key-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.8 KB
...in-left-to-right-using-stacked-layout-and-disabled-should-be-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24.3 KB
...in-right-to-left-using-stacked-layout-and-disabled-should-be-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.46 KB
(110%)
...ey-disabled-should-not-have-screen-reader-text-related-to-access-key-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
-90 Bytes
(100%)
...ey-disabled-should-not-have-screen-reader-text-related-to-access-key-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.4 KB
...ons-style-options-js-suggested-actions-when-overriding-style-options-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.5 KB
...ons-style-options-js-suggested-actions-when-overriding-style-options-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+16.5 KB
...ons-style-options-js-suggested-actions-when-overriding-style-options-3-snap.png
Oops, something went wrong.
Binary file added
BIN
+16.1 KB
...ons-style-options-js-suggested-actions-when-overriding-style-options-4-snap.png
Oops, something went wrong.
Binary file added
BIN
+16.5 KB
...ons-style-options-js-suggested-actions-when-overriding-style-options-5-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.6 KB
...ons-style-options-js-suggested-actions-when-overriding-style-options-6-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.2 KB
...s-js-suggested-actions-when-overriding-with-deprecated-style-options-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.5 KB
...s-js-suggested-actions-when-overriding-with-deprecated-style-options-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+16.2 KB
...s-js-suggested-actions-when-overriding-with-deprecated-style-options-3-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.9 KB
...s-js-suggested-actions-when-overriding-with-deprecated-style-options-4-snap.png
Oops, something went wrong.
Binary file added
BIN
+16.4 KB
...s-js-suggested-actions-when-overriding-with-deprecated-style-options-5-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.4 KB
...s-js-suggested-actions-when-overriding-with-deprecated-style-options-6-snap.png
Oops, something went wrong.
Binary file added
BIN
+14.4 KB
...-style-options-js-suggested-actions-when-using-default-style-options-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+14.6 KB
...-style-options-js-suggested-actions-when-using-default-style-options-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+14.4 KB
...-style-options-js-suggested-actions-when-using-default-style-options-3-snap.png
Oops, something went wrong.
Binary file added
BIN
+14.5 KB
...-style-options-js-suggested-actions-when-using-default-style-options-4-snap.png
Oops, something went wrong.
Binary file added
BIN
+14.5 KB
...-style-options-js-suggested-actions-when-using-default-style-options-5-snap.png
Oops, something went wrong.
Binary file added
BIN
+14.4 KB
...-style-options-js-suggested-actions-when-using-default-style-options-6-snap.png
Oops, something went wrong.
Binary file added
BIN
+12 KB
...avior-should-keep-activity-focus-when-interactive-element-is-focused-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+15.3 KB
...avior-should-keep-activity-focus-when-interactive-element-is-focused-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+18.5 KB
...age-behavior-should-focus-on-last-activity-when-focus-is-on-send-box-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+22 KB
...age-behavior-should-focus-on-last-activity-when-focus-is-on-send-box-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+19.1 KB
...age-behavior-should-focus-on-last-activity-when-focus-is-on-send-box-3-snap.png
Oops, something went wrong.
Binary file added
BIN
+21.8 KB
...age-behavior-should-focus-on-last-activity-when-focus-is-on-send-box-4-snap.png
Oops, something went wrong.
Binary file added
BIN
+24.8 KB
...age-behavior-should-focus-on-last-activity-when-focus-is-on-send-box-5-snap.png
Oops, something went wrong.
Binary file added
BIN
+21.2 KB
...-should-auto-select-last-activity-when-shift-tab-into-the-transcript-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+21.1 KB
...-should-auto-select-last-activity-when-shift-tab-into-the-transcript-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+21.2 KB
...gation-should-auto-select-last-activity-when-tab-into-the-transcript-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+21.1 KB
...gation-should-auto-select-last-activity-when-tab-into-the-transcript-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+26.2 KB
...n-transcript-using-keyboard-should-scroll-focused-activity-into-view-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+25.9 KB
...n-transcript-using-keyboard-should-scroll-focused-activity-into-view-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+26.2 KB
...n-transcript-using-keyboard-should-scroll-focused-activity-into-view-3-snap.png
Oops, something went wrong.
Binary file added
BIN
+26.2 KB
...-transcript-using-mouse-should-not-scroll-focused-activity-into-view-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+25.9 KB
...-transcript-using-mouse-should-not-scroll-focused-activity-into-view-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+26.6 KB
...-transcript-using-mouse-should-not-scroll-focused-activity-into-view-3-snap.png
Oops, something went wrong.
Binary file added
BIN
+26.2 KB
...-transcript-using-mouse-should-not-scroll-focused-activity-into-view-4-snap.png
Oops, something went wrong.
Binary file modified
BIN
+2.82 KB
(120%)
...se-text-box-submit-main-js-use-text-box-submit-and-set-focus-to-main-1-snap.png
Oops, something went wrong.
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
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
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
47 changes: 47 additions & 0 deletions
47
__tests__/html/autoScroll.withSuggestedActions.submitAdaptiveCards.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
<head> | ||
<link href="/assets/index.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> | ||
<div id="webchat"></div> | ||
<script> | ||
run(async function () { | ||
WebChat.renderWebChat( | ||
{ | ||
directLine: WebChat.createDirectLine({ token: await testHelpers.token.fetchDirectLineToken() }), | ||
store: testHelpers.createStore() | ||
}, | ||
document.getElementById('webchat') | ||
); | ||
|
||
await pageConditions.uiConnected(); | ||
|
||
// GIVEN: A ready-to-submit Adaptive Card with suggested actions shown below | ||
await pageObjects.sendMessageViaSendBox('card inputs', { waitForSend: true }); | ||
await pageConditions.minNumActivitiesShown(2); | ||
|
||
await pageObjects.sendMessageViaSendBox('suggested-actions', { waitForSend: true }); | ||
await pageConditions.suggestedActionsShown(); | ||
await pageConditions.scrollToBottomCompleted(); | ||
|
||
// To submit the input form, the number field is mandatory. | ||
document.querySelector('.ac-adaptiveCard input[type="number"]').value = '1'; | ||
|
||
// WHEN: The Adaptive Card is being submitted. | ||
const submitButton = await document.querySelector('button.ac-pushButton:nth-of-type(2)'); | ||
|
||
await submitButton.click(); | ||
await pageConditions.minNumActivitiesShown(5); | ||
|
||
// THEN: It should stick to the bottom. | ||
await pageConditions.scrollToBottomCompleted(); | ||
|
||
await host.snapshot(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
6 changes: 6 additions & 0 deletions
6
__tests__/html/autoScroll.withSuggestedActions.submitAdaptiveCards.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ | ||
|
||
describe('Auto-scroll with suggested actions shown', () => { | ||
test('should stick to bottom if submitting an Adaptive Card', () => | ||
runHTML('autoScroll.withSuggestedActions.submitAdaptiveCards.html')); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
<head> | ||
<link href="/assets/index.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> | ||
<div id="webchat"></div> | ||
<script> | ||
run(async function () { | ||
const directLine = testHelpers.createDirectLineWithTranscript([]); | ||
const store = testHelpers.createStore(); | ||
const useDefault = new URLSearchParams(location.search).get('default'); | ||
|
||
function render(overrideProps) { | ||
WebChat.renderWebChat( | ||
{ | ||
directLine, | ||
store, | ||
...overrideProps, | ||
styleOptions: { | ||
...(useDefault | ||
? {} | ||
: { | ||
sendBoxButtonShadeBorderRadius: 5, | ||
sendBoxButtonShadeInset: 3, | ||
|
||
sendBoxButtonKeyboardFocusIndicatorBorderColor: 'rgba(0, 255, 255, 1)', | ||
sendBoxButtonKeyboardFocusIndicatorBorderRadius: '100%', | ||
sendBoxButtonKeyboardFocusIndicatorBorderStyle: 'dashed', | ||
sendBoxButtonKeyboardFocusIndicatorBorderWidth: 2, | ||
sendBoxButtonKeyboardFocusIndicatorInset: 6, | ||
|
||
sendBoxButtonColor: 'rgba(255, 0, 0, 1)', | ||
sendBoxButtonShadeColor: 'rgba(255, 0, 0, .4)', | ||
|
||
sendBoxButtonColorOnActive: 'rgba(255, 0, 255, 1)', | ||
sendBoxButtonShadeColorOnActive: 'rgba(255, 0, 255, .4)', | ||
|
||
sendBoxButtonColorOnDisabled: 'rgba(255, 255, 0, 1)', | ||
sendBoxButtonShadeColorOnDisabled: 'rgba(255, 255, 0, .4)', | ||
|
||
sendBoxButtonColorOnFocus: 'rgba(0, 255, 0, 1)', | ||
sendBoxButtonShadeColorOnFocus: 'rgba(0, 255, 0, .4)', | ||
|
||
sendBoxButtonColorOnHover: 'rgba(0, 0, 255, 1)', | ||
sendBoxButtonShadeColorOnHover: 'rgba(0, 0, 255, .4)' | ||
}), | ||
...overrideProps?.styleOptions | ||
} | ||
}, | ||
document.getElementById('webchat') | ||
); | ||
} | ||
|
||
render(); | ||
|
||
// GIVEN: Web Chat is rendered with no activities and focus is on the send box. | ||
await pageConditions.uiConnected(); | ||
await pageObjects.focusSendBoxTextBox(); | ||
await host.snapshot(); | ||
|
||
// WHEN: Web Chat is disabled | ||
render({ disabled: true }); | ||
await pageConditions.uiConnected(); | ||
|
||
// THEN: Send box buttons should be disabled. | ||
await host.snapshot(); | ||
|
||
// WHEN: Press TAB to focus on the send button. | ||
render(); | ||
await pageConditions.uiConnected(); | ||
await host.sendTab(); | ||
|
||
// THEN: A focus-visible border should surround the send button. | ||
await host.snapshot(); | ||
|
||
// WHEN: Hover mouse on the send button. | ||
await host.hover(pageElements.sendButton()); | ||
|
||
// THEN: Both focus-visible border and shaded background should appear behind the send button. | ||
await host.snapshot(); | ||
|
||
// WHEN: Press-and-hold the send button. | ||
await host.pressAndHold(pageElements.sendButton()); | ||
|
||
// THEN: Both focus-visible border and shaded background should appear. | ||
await host.snapshot(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ | ||
|
||
describe('send box button', () => { | ||
test('with different style options', () => runHTML('sendBox.button.styleOptions')); | ||
test('with default style options', () => runHTML('sendBox.button.styleOptions?default=true')); | ||
}); |
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
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
Oops, something went wrong.