Skip to content
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

Transcript navigation by arrow keys #3703

Merged
merged 66 commits into from
Feb 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
7cae582
Use arrow keys to scroll up/down
compulim Feb 3, 2021
8badd75
Add useScrollDown and useScrollUp
compulim Feb 3, 2021
3d7d808
Add useScrollUp and useScrollDown test
compulim Feb 3, 2021
987c293
Add comments
compulim Feb 4, 2021
d6d94f7
Update CHANGELOG.md
corinagum Feb 4, 2021
2ddb155
Move comment
compulim Feb 4, 2021
c0203d3
Add active descendant
compulim Feb 8, 2021
cacf799
Clean up
compulim Feb 8, 2021
deee0d5
Move type focus sink to send box and allow multiple focii
compulim Feb 8, 2021
b079816
Use ARIA_ROLE for now
compulim Feb 8, 2021
b443a73
Apply PR suggestions
compulim Feb 8, 2021
2c53f4b
Apply suggestions from code review
compulim Feb 8, 2021
8ca368e
Update packages/component/src/BasicTranscript.js
compulim Feb 8, 2021
cbd64ea
IE11 styling
compulim Feb 8, 2021
a9be558
Localize terminator text
compulim Feb 8, 2021
2427d9c
Fix localization
compulim Feb 8, 2021
72ec633
Add HOME/END keys
compulim Feb 8, 2021
2a08176
Add "Press ENTER to interact" label
compulim Feb 9, 2021
99516e3
Fix warnings
compulim Feb 11, 2021
3afbc59
Add tests
compulim Feb 11, 2021
3dcdaee
Add escape key test
compulim Feb 12, 2021
a1d1d08
Ponyfill scrollIntoView
compulim Feb 12, 2021
ab8dbe8
Add tests
compulim Feb 12, 2021
9bef1f8
Update tests
compulim Feb 12, 2021
a84e6ed
Update tests
compulim Feb 12, 2021
b79806d
Fix tests
compulim Feb 12, 2021
df2ead4
Fix tests
compulim Feb 12, 2021
c22391b
Fix tests
compulim Feb 12, 2021
2410978
Fix tests
compulim Feb 12, 2021
3fc2ccf
Move useTextBox to html
compulim Feb 12, 2021
0f56865
Fix test
compulim Feb 12, 2021
deeacd4
Remove redundant test
compulim Feb 12, 2021
e419c52
Fix tests
compulim Feb 12, 2021
44d47b9
Fix tests
compulim Feb 12, 2021
dbe5db8
Fix tests
compulim Feb 12, 2021
0b43980
Fix tests
compulim Feb 12, 2021
9330912
Fix test
compulim Feb 12, 2021
bf1d4a0
Fix tests
compulim Feb 12, 2021
7e41ec4
Fix test
compulim Feb 12, 2021
619d761
Add test for clicking on Adaptve Card widgets
compulim Feb 12, 2021
a081fbe
Fix test
compulim Feb 12, 2021
74a4b49
Fix test
compulim Feb 12, 2021
c14548a
Fix test
compulim Feb 12, 2021
bb14ba7
Fix test
compulim Feb 12, 2021
23bb832
Fix tests
compulim Feb 12, 2021
1d23e92
Update entry
compulim Feb 12, 2021
8050c7a
Fix test
compulim Feb 12, 2021
5ccc33c
Fix test
compulim Feb 12, 2021
b25ab7c
Fix test
compulim Feb 12, 2021
3a0bc0d
Fix test
compulim Feb 12, 2021
5d74ac5
Fix test
compulim Feb 12, 2021
d228b69
Fix test
compulim Feb 12, 2021
e24c8fe
Terminate sooner
compulim Feb 12, 2021
e2b5459
Fix test
compulim Feb 12, 2021
a8d9101
Ignore test files
compulim Feb 12, 2021
2d352b9
Improve reliability
compulim Feb 12, 2021
15a7700
Apply suggestions from code review
compulim Feb 14, 2021
b64f6bb
Add comments
compulim Feb 14, 2021
44d5b18
Add comment
compulim Feb 14, 2021
4563666
Add comment
compulim Feb 14, 2021
8f1de12
Add style options
compulim Feb 14, 2021
4eea925
Change to <button>
compulim Feb 14, 2021
e0c6ff4
Remove unneeded comma
compulim Feb 14, 2021
c126d45
Apply suggestions from code review
compulim Feb 14, 2021
d2bbfd3
Rename "activate" to "focus"
compulim Feb 14, 2021
de198a7
Remove unneeded onkeypress
compulim Feb 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Resolves [#3368](https://github.com/microsoft/BotFramework-WebChat/issues/3368). Added new `sendBoxButtonAlignment` for button alignment in multi-line text mode, by [@compulim](https://github.com/compulim) in PR [#3668](https://github.com/microsoft/BotFramework-WebChat/pull/3668)
- Resolves [#3666](https://github.com/microsoft/BotFramework-WebChat/issues/3666). Added support of sovereign clouds when using Direct Line Speech, by [@compulim](https://github.com/compulim) in PR [#3694](https://github.com/microsoft/BotFramework-WebChat/pull/3694)
- Please refer to [`DIRECT_LINE_SPEECH.md`](https://github.com/microsoft/BotFramework-WebChat/blob/master/docs/DIRECT_LINE_SPEECH.md#directlinespeechcredentials) for instructions
- Resolves [#2996](https://github.com/microsoft/BotFramework-WebChat/issues/2996). Added transcript navigation by keyboard navigation keys, by [@compulim](https://github.com/compulim) in PR [#3703](https://github.com/microsoft/BotFramework-WebChat/pull/3703)

### Fixed

Expand Down
6 changes: 4 additions & 2 deletions __tests__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
globals:
runHTMLTest: readonly
ignorePatterns:
- "**/*.js"
- "!/html/__jest__/*.js"
- "!/setup/*.js"
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
13 changes: 0 additions & 13 deletions __tests__/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,6 @@ test('long URLs with keep-all', async () => {
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('unknown activities do not render anything in the transcript', async () => {
corinagum marked this conversation as resolved.
Show resolved Hide resolved
const { driver, pageObjects } = await setupWebDriver();

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('unknown activity', { waitForSend: true });

await driver.wait(minNumActivitiesShown(1), timeouts.directLine);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('hero card with a long title and richCardWrapTitle set to true', async () => {
const { driver, pageObjects } = await setupWebDriver({ props: { styleOptions: { richCardWrapTitle: true } } });

Expand Down
4 changes: 2 additions & 2 deletions __tests__/clockSkew.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('Clock skew', () => {
await driver.wait(minNumActivitiesShown(3), timeouts.directLine);

const activityElements = await getActivityElements(driver);
const lastActivityParagraphElement = await activityElements[activityElements.length - 1].findElement(By.css('p'));
const lastActivityParagraphElement = await activityElements[activityElements.length - 1].findElement(By.css('.webchat__basic-transcript__activity-box p'));

await expect(lastActivityParagraphElement.getText()).resolves.toBe(
'echo This outgoing activity should be the last in the list.'
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('Clock skew', () => {
await driver.wait(minNumActivitiesShown(3), timeouts.directLine);

const activityElements = await getActivityElements(driver);
const firstActivityParagraphElement = await activityElements[0].findElement(By.css('p'));
const firstActivityParagraphElement = await activityElements[0].findElement(By.css('.webchat__basic-transcript__activity-box p'));

await expect(firstActivityParagraphElement.getText()).resolves.toBe(
'echo This outgoing activity should be the first in the list before echo back, and last after the echo back.'
Expand Down
65 changes: 0 additions & 65 deletions __tests__/hooks/useScrollToEnd.js

This file was deleted.

40 changes: 0 additions & 40 deletions __tests__/hooks/useTextBox.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Components: { AdaptiveCardContent }
} = window.WebChat;

(async function() {
(async function () {
const store = createStore();
const directLine = window.WebChat.createDirectLine({ token: await token.fetchDirectLineToken() });
const baseProps = { directLine, store };
Expand All @@ -42,9 +42,7 @@

await host.sendShiftTab();

const blurred = document.activeElement === document.body || !document.activeElement;

expect(blurred).toBe(true);
expect(document.activeElement === elements.transcript()).toBe(true);

// There should be no yellow part on the screen as there are no focusing elements.
await host.snapshot();
Expand Down
37 changes: 37 additions & 0 deletions __tests__/html/activity.unknownActivity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<script crossorigin="anonymous" src="/__dist__/testharness.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<div id="webchat"></div>
<script type="text/babel" data-presets="env,stage-3,react">
const {
WebChat: { createDirectLine },
WebChatTest: { conditions, createStore, host, pageObjects, timeouts, token }
} = window;

(async function () {
window.WebChat.renderWebChat(
{
directLine: createDirectLine({ token: await token.fetchDirectLineToken() }),
store: createStore()
},
document.getElementById('webchat')
);

await pageObjects.wait(conditions.uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('unknown activity');
await pageObjects.wait(conditions.minNumActivitiesShown(1), timeouts.directLine);

await host.snapshot();
await host.done();
})().catch(async err => {
console.error(err);

await host.error(err);
});
</script>
</body>
</html>
8 changes: 8 additions & 0 deletions __tests__/html/activity.unknownActivity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @jest-environment ./__tests__/html/__jest__/WebChatEnvironment.js
*/

describe('activity', () => {
test('should not show unknown activity', () =>
runHTMLTest('activity.unknownActivity.html', { ignoreConsoleError: true }));
});
12 changes: 7 additions & 5 deletions __tests__/html/adaptiveCards.tapAction.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
return new Uint8Array(byteArray).buffer;
}

(async function() {
(async function () {
window.WebChat.renderWebChat(
{
activityMiddleware: createRunHookActivityMiddleware(),
Expand Down Expand Up @@ -78,7 +78,9 @@
fileBlob.name = 'hello-card.attachmentjson';

await pageObjects.runHook(({ useSendFiles }) => useSendFiles()([fileBlob]));
await pageObjects.wait(conditions.minNumActivitiesShown(2), timeouts.directLine);

// When using runHookActivityMiddleware, an additional hidden activities will be rendered to run the hook function. Thus, minNumActivitiesShown must be +1.
await pageObjects.wait(conditions.minNumActivitiesShown(3), timeouts.directLine);

const renderer = document.querySelector('.webchat__adaptive-card-renderer');
const card = renderer.querySelector('.ac-adaptiveCard[tabindex="0"]');
Expand All @@ -87,17 +89,17 @@

renderer.click();

await pageObjects.wait(conditions.minNumActivitiesShown(4), timeouts.directLine);
await pageObjects.wait(conditions.minNumActivitiesShown(5), timeouts.directLine);

card.focus();
await host.sendKeys('\n');

await pageObjects.wait(conditions.minNumActivitiesShown(6), timeouts.directLine);
await pageObjects.wait(conditions.minNumActivitiesShown(7), timeouts.directLine);

card.focus();
await host.sendKeys(' ');

await pageObjects.wait(conditions.minNumActivitiesShown(8), timeouts.directLine);
await pageObjects.wait(conditions.minNumActivitiesShown(9), timeouts.directLine);

await pageObjects.wait(conditions.scrollToBottomCompleted(), timeouts.scrollToBottom);
await host.snapshot();
Expand Down
Loading