-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Focus on the close button of keyboard help screen (#4479)
* Focus on the close button * Add entry * Transpile bent to ES5 * Make SVGs non-focusable in IE11 * Add entry * Update comment * Update snapshot
- Loading branch information
Showing
34 changed files
with
358 additions
and
13 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 added
BIN
+9.79 KB
...s-keyboard-help-screen-should-close-when-the-close-button-is-clicked-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
+45.7 KB
...s-keyboard-help-screen-should-close-when-the-close-button-is-clicked-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
+12.3 KB
...s-keyboard-help-screen-should-close-when-the-close-button-is-clicked-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
+9.79 KB
...eyboard-help-screen-should-not-interfere-when-clicking-on-activities-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
+45.7 KB
...eyboard-help-screen-should-not-interfere-when-clicking-on-activities-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
+9.8 KB
...eyboard-help-screen-should-not-interfere-when-clicking-on-activities-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
+12.2 KB
...eyboard-help-screen-should-not-interfere-when-clicking-on-activities-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
+9.79 KB
...-key-js-keyboard-help-screen-should-close-when-escape-key-is-pressed-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
+45.7 KB
...-key-js-keyboard-help-screen-should-close-when-escape-key-is-pressed-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
+12.3 KB
...-key-js-keyboard-help-screen-should-close-when-escape-key-is-pressed-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
+9.79 KB
...yboard-help-screen-should-close-when-tab-away-and-show-when-tab-back-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
+45.7 KB
...yboard-help-screen-should-close-when-tab-away-and-show-when-tab-back-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
+12.3 KB
...yboard-help-screen-should-close-when-tab-away-and-show-when-tab-back-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
+45.7 KB
...yboard-help-screen-should-close-when-tab-away-and-show-when-tab-back-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
+9.79 KB
...yboard-help-screen-should-close-when-tab-away-and-show-when-tab-back-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
-4 Bytes
(100%)
...ator-js-transcript-navigation-should-show-visual-keyboard-indicators-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
-4 Bytes
(100%)
...ator-js-transcript-navigation-should-show-visual-keyboard-indicators-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.
64 changes: 64 additions & 0 deletions
64
__tests__/html/accessibility.keyboardHelp.clickCloseButton.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,64 @@ | ||
<!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 store = testHelpers.createStore(); | ||
|
||
const directLine = testHelpers.createDirectLineEmulator(store); | ||
|
||
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat')); | ||
|
||
await pageConditions.uiConnected(); | ||
|
||
// SETUP: With 2 bot messages. | ||
await directLine.emulateIncomingActivity('Hello, World!'); | ||
await directLine.emulateIncomingActivity('Aloha!'); | ||
await pageConditions.numActivitiesShown(2); | ||
|
||
// THEN: The focus should be on `document.body` initially. | ||
await pageConditions.focusOn(document.body, 'document body'); | ||
|
||
// THEN: The keyboard help screeen should not be visible initially. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: TAB key is pressed. | ||
await host.sendTab(); | ||
|
||
// THEN: It should focus on the close button. | ||
await pageConditions.focusOn(pageElements.keyboardHelpScreenCloseButton(), 'keyboard help screen close button'); | ||
|
||
// THEN: The keyboard help screeen show be visible. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: SPACE BAR is pressed while the focus is on the close button. | ||
await host.sendKeys(' '); | ||
|
||
// THEN: It should focus on the chat history. | ||
await pageConditions.focusOn(pageElements.transcript(), 'chat history'); | ||
|
||
// THEN: It should focus on the last message in the chat history. | ||
await pageConditions.became( | ||
'focus on the last message', | ||
() => pageElements.focusedActivity() === pageElements.activities()[1], | ||
1000 | ||
); | ||
|
||
// THEN: The keyboard help screeen show be closed (not visible). | ||
// The chat history and the last message should be focused. | ||
await host.snapshot(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
6 changes: 6 additions & 0 deletions
6
__tests__/html/accessibility.keyboardHelp.clickCloseButton.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('keyboard help screen', () => { | ||
test('should close when the close button is clicked', () => | ||
runHTML('accessibility.keyboardHelp.clickCloseButton')); | ||
}); |
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,74 @@ | ||
<!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 store = testHelpers.createStore(); | ||
|
||
const directLine = testHelpers.createDirectLineEmulator(store); | ||
|
||
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat')); | ||
|
||
await pageConditions.uiConnected(); | ||
|
||
// SETUP: With 2 bot messages. | ||
await directLine.emulateIncomingActivity('Hello, World!'); | ||
await directLine.emulateIncomingActivity('Aloha!'); | ||
await pageConditions.numActivitiesShown(2); | ||
|
||
// THEN: The focus should be on `document.body` initially. | ||
await pageConditions.focusOn(document.body, 'document body'); | ||
|
||
// THEN: The keyboard help screeen should not be visible initially. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: TAB key is pressed. | ||
await host.sendTab(); | ||
|
||
// THEN: It should focus on the close button. | ||
await pageConditions.focusOn(pageElements.keyboardHelpScreenCloseButton(), 'keyboard help screen close button'); | ||
|
||
// THEN: The keyboard help screeen show be visible. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: Click to focus on the send box text box. | ||
await host.click(pageElements.sendBoxTextBox()); | ||
await pageConditions.focusOn(pageElements.sendBoxTextBox(), 'send box text box'); | ||
|
||
// THEN: The keyboard help screen should not be visible. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: Click on the first message. | ||
await host.click(pageElements.activities()[0]); | ||
|
||
// THEN: It should focus on the chat history. | ||
// The invisible keyboard help screen should not block clicks. | ||
await pageConditions.focusOn(pageElements.transcript(), 'chat history'); | ||
|
||
// THEN: It should focus on the first message in the chat history. | ||
await pageConditions.became( | ||
'focus on the first activity', | ||
() => pageElements.focusedActivity() === pageElements.activities()[0], | ||
1000 | ||
); | ||
|
||
// THEN: The keyboard help screeen should not be visible. | ||
// The chat history and the first message should be focused. | ||
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('keyboard help screen', () => { | ||
test('should not interfere when clicking on activities', () => | ||
runHTML('accessibility.keyboardHelp.clickThru')); | ||
}); |
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,57 @@ | ||
<!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 store = testHelpers.createStore(); | ||
|
||
const directLine = testHelpers.createDirectLineEmulator(store); | ||
|
||
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat')); | ||
|
||
await pageConditions.uiConnected(); | ||
|
||
// SETUP: With 2 bot messages. | ||
await directLine.emulateIncomingActivity('Hello, World!'); | ||
await directLine.emulateIncomingActivity('Aloha!'); | ||
await pageConditions.numActivitiesShown(2); | ||
|
||
// THEN: The focus should be on `document.body` initially. | ||
await pageConditions.focusOn(document.body, 'document body'); | ||
|
||
// THEN: The keyboard help screeen should not be visible initially. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: TAB key is pressed. | ||
await host.sendTab(); | ||
|
||
// THEN: It should focus on the close button. | ||
await pageConditions.focusOn(pageElements.keyboardHelpScreenCloseButton(), 'keyboard help screen close button'); | ||
|
||
// THEN: The keyboard help screeen show be visible. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: ESCAPE key is pressed. | ||
await host.sendKeys('ESCAPE'); | ||
|
||
// THEN: It should focus on the chat history. | ||
await pageConditions.focusOn(pageElements.transcript(), 'chat history'); | ||
|
||
// THEN: It should close the keyboard help screen. | ||
// The chat history and the last message should be focused. | ||
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('keyboard help screen', () => { | ||
test('should close when ESCAPE key is pressed', () => | ||
runHTML('accessibility.keyboardHelp.escapeKey')); | ||
}); |
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,87 @@ | ||
<!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 store = testHelpers.createStore(); | ||
|
||
const directLine = testHelpers.createDirectLineEmulator(store); | ||
|
||
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat')); | ||
|
||
await pageConditions.uiConnected(); | ||
|
||
// SETUP: With 2 bot messages. | ||
await directLine.emulateIncomingActivity('Hello, World!'); | ||
await directLine.emulateIncomingActivity('Aloha!'); | ||
await pageConditions.numActivitiesShown(2); | ||
|
||
// THEN: The focus should be on `document.body` initially. | ||
await pageConditions.focusOn(document.body, 'document body'); | ||
|
||
// THEN: The keyboard help screeen should not be visible initially. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: TAB key is pressed. | ||
await host.sendTab(); | ||
|
||
// THEN: It should focus on the close button. | ||
await pageConditions.focusOn(pageElements.keyboardHelpScreenCloseButton(), 'keyboard help screen close button'); | ||
|
||
// THEN: The keyboard help screeen show be visible. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: TAB key is pressed. | ||
await host.sendTab(); | ||
|
||
// THEN: It should focus on the chat history. | ||
await pageConditions.focusOn(pageElements.transcript(), 'chat history'); | ||
|
||
// THEN: It should focus on the last message in the chat history. | ||
await pageConditions.became( | ||
'focus on the last message', | ||
() => pageElements.focusedActivity() === pageElements.activities()[1], | ||
1000 | ||
); | ||
|
||
// THEN: The keyboard help screeen show be closed (not visible). | ||
// The chat history and the last message should be focused. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: SHIFT-TAB key is pressed. | ||
await host.sendShiftTab(); | ||
|
||
// THEN: It should focus on the close button. | ||
await pageConditions.focusOn(pageElements.keyboardHelpScreenCloseButton(), 'keyboard help screen close button'); | ||
|
||
// THEN: The keyboard help screeen show be visible. | ||
await host.snapshot(); | ||
|
||
// --- | ||
|
||
// WHEN: SHIFT-TAB key is pressed while the keyboard help screen is visible. | ||
await host.sendShiftTab(); | ||
|
||
// THEN: It should focus on the document body. | ||
await pageConditions.focusOn(document.body, 'document body'); | ||
|
||
// THEN: The keyboard help screeen show be closed (not visible). | ||
// As the focus is on document body, nothing in view should have focus ring. | ||
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('keyboard help screen', () => { | ||
test('should close when TAB away and show when TAB back', () => | ||
runHTML('accessibility.keyboardHelp.tabKey')); | ||
}); |
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
Oops, something went wrong.