diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc552b61e..2136675490 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixes [#4295](https://github.com/microsoft/BotFramework-WebChat/issues/4295). Screen reader should not read suggested actions twice when message arrive in live region, by [@compulim](https://github.com/compulim), in PR [#4323](https://github.com/microsoft/BotFramework-WebChat/issues/4323) - Fixes [#4325](https://github.com/microsoft/BotFramework-WebChat/issues/4325). `aria-keyshortcuts` should use modifier keys according to `KeyboardEvent` key values spec, by [@compulim](https://github.com/compulim), in PR [#4323](https://github.com/microsoft/BotFramework-WebChat/issues/4323) - Fixes [#4327](https://github.com/microsoft/BotFramework-WebChat/issues/4327). In Adaptive Cards, `TextBlock` with `style="heading"` should have `aria-level` set, by [@compulim](https://github.com/compulim), in PR [#4329](https://github.com/microsoft/BotFramework-WebChat/issues/4329) +- Fixes [#3949](https://github.com/microsoft/BotFramework-WebChat/issues/3949). For accessibility reasons, buttons in Adaptive Cards should be `role="button"` instead of `role="menubar"`/`role="menuitem"`, by [@compulim](https://github.com/compulim), in PR [#4263](https://github.com/microsoft/BotFramework-WebChat/issues/4263) ## Changes diff --git a/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-1-snap.png b/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-1-snap.png deleted file mode 100644 index 21f4d5279d..0000000000 Binary files a/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-1-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-2-snap.png b/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-2-snap.png deleted file mode 100644 index ab80b073aa..0000000000 Binary files a/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-2-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-3-snap.png b/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-3-snap.png deleted file mode 100644 index 613d00a959..0000000000 Binary files a/__tests__/__image_snapshots__/chrome-docker/adaptive-cards-js-disable-card-inputs-3-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-focus-with-show-card-js-accessibility-requirement-disabling-adaptive-card-with-action-show-card-1-snap.png b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-focus-with-show-card-js-accessibility-requirement-disabling-adaptive-card-with-action-show-card-1-snap.png new file mode 100644 index 0000000000..057441db1d Binary files /dev/null and b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-focus-with-show-card-js-accessibility-requirement-disabling-adaptive-card-with-action-show-card-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-focus-with-show-card-js-accessibility-requirement-disabling-adaptive-card-with-action-show-card-2-snap.png b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-focus-with-show-card-js-accessibility-requirement-disabling-adaptive-card-with-action-show-card-2-snap.png new file mode 100644 index 0000000000..4d63a1a427 Binary files /dev/null and b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-focus-with-show-card-js-accessibility-requirement-disabling-adaptive-card-with-action-show-card-2-snap.png differ diff --git a/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-1-snap.png b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-1-snap.png new file mode 100644 index 0000000000..d934f4936f Binary files /dev/null and b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-2-snap.png b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-2-snap.png new file mode 100644 index 0000000000..09670600aa Binary files /dev/null and b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-2-snap.png differ diff --git a/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-3-snap.png b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-3-snap.png new file mode 100644 index 0000000000..8cae3ceb11 Binary files /dev/null and b/__tests__/__image_snapshots__/html/accessibility-adaptive-card-disabled-inputs-js-accessibility-requirement-disabling-adaptive-card-with-inputs-field-3-snap.png differ diff --git a/__tests__/__image_snapshots__/html/focus-management-disable-adaptive-card-manual-js-focus-management-focus-should-not-move-after-adaptive-card-is-disable-after-manually-disabled-3-snap.png b/__tests__/__image_snapshots__/html/focus-management-disable-adaptive-card-manual-js-focus-management-focus-should-not-move-after-adaptive-card-is-disable-after-manually-disabled-3-snap.png index e061e5ffdc..92a97747b6 100644 Binary files a/__tests__/__image_snapshots__/html/focus-management-disable-adaptive-card-manual-js-focus-management-focus-should-not-move-after-adaptive-card-is-disable-after-manually-disabled-3-snap.png and b/__tests__/__image_snapshots__/html/focus-management-disable-adaptive-card-manual-js-focus-management-focus-should-not-move-after-adaptive-card-is-disable-after-manually-disabled-3-snap.png differ diff --git a/__tests__/adaptiveCards.js b/__tests__/adaptiveCards.js index 9397d3145f..9d6ce55744 100644 --- a/__tests__/adaptiveCards.js +++ b/__tests__/adaptiveCards.js @@ -97,69 +97,6 @@ test('breakfast card with custom style options', async () => { expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions); }); -test('disable card inputs', async () => { - const { driver, pageObjects } = await setupWebDriver(); - - await driver.wait(uiConnected(), timeouts.directLine); - await pageObjects.sendMessageViaSendBox('card inputs', { waitForSend: true }); - - await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await driver.wait(allImagesLoaded(), timeouts.fetchImage); - await driver.wait(scrollToBottomCompleted(), timeouts.scrollToBottom); - - await driver.executeScript(() => { - document.querySelector('.ac-adaptiveCard input[type="checkbox"]').checked = true; - document.querySelector('.ac-adaptiveCard input[type="date"]').value = '2019-11-01'; - document.querySelector('.ac-adaptiveCard input[type="radio"]').checked = true; - document.querySelector('.ac-adaptiveCard input[type="text"]').value = 'William'; - document.querySelector('.ac-adaptiveCard input[type="time"]').value = '12:34'; - document.querySelector('.ac-adaptiveCard input[type="number"]').value = '1'; - document.querySelector('.ac-adaptiveCard select').value = '1'; - document.querySelector('.ac-adaptiveCard textarea').value = 'One Redmond Way, Redmond, WA'; - }); - - expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); - - await pageObjects.updateProps({ disabled: true }); - await driver.wait(scrollToBottomCompleted(), timeouts.scrollToBottom); - - // Click "Submit" button should have no effect - await driver.executeScript(() => { - document.querySelector('.ac-actionSet button:nth-of-type(2)').click(); - }); - - //@todo change to use scrollStabilizer after release - await new Promise(resolve => setTimeout(resolve, 1000)); - - expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); - - await pageObjects.updateProps({ disabled: false }); - - // Wait until render after update props - await driver.wait( - () => - driver.executeScript(() => { - const button = document.querySelector('.ac-actionSet button:nth-of-type(2)'); - - return button && !button.disabled; - }), - timeouts.ui - ); - - // Click "Submit" button should send values to the bot - await driver.executeScript(() => { - document.querySelector('.ac-actionSet button:nth-of-type(2)').click(); - }); - - //@todo change to use scrollStabilizer after release - await new Promise(resolve => setTimeout(resolve, 1000)); - - await driver.wait(minNumActivitiesShown(3), timeouts.directLine); - await driver.wait(scrollToBottomCompleted(), timeouts.scrollToBottom); - - expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); -}); - test('broken card of invalid version', async () => { const { driver, pageObjects } = await setupWebDriver(); diff --git a/__tests__/html/accessibility.adaptiveCard.ariaPushed.html b/__tests__/html/accessibility.adaptiveCard.ariaPushed.html index da7337b4f7..5f5938b142 100644 --- a/__tests__/html/accessibility.adaptiveCard.ariaPushed.html +++ b/__tests__/html/accessibility.adaptiveCard.ariaPushed.html @@ -34,26 +34,6 @@ return false; } - /** Checks if the page is conform to a subset of WCAG. */ - // TODO: We should use axe-core to validate WAI-ARIA conformity. - function expectWCAGConformity() { - // EXPECT: Conform to WAI-ARIA, all "menubar" should have 1 or more descendants of "menuitem". - [...document.querySelectorAll('[role="menubar"]')].forEach(menuBar => - expect(menuBar.querySelectorAll('[role="menuitem"]').length).toBeTruthy() - ); - - // EXPECT: Conform to WAI-ARIA, all "menuitem" should be a descendant of "menu" or "menubar". - [...document.querySelectorAll('[role="menuitem"]')].forEach(menuItem => { - expect( - hasAncestor(menuItem, ancestor => { - const ancestorRole = ancestor.getAttribute('role'); - - return ancestorRole === 'menu' || ancestorRole === 'menubar'; - }) - ).toBeTruthy(); - }); - } - run(async function () { const directLine = await testHelpers.createDirectLineWithTranscript([ { @@ -127,34 +107,20 @@ await pageConditions.numActivitiesShown(1); await pageConditions.scrollToBottomCompleted(); - // GIVEN: There should be 2 set of `ac-actionSet` containers. - expect(document.querySelectorAll('.ac-actionSet')).toHaveLength(2); + // SETUP: Focus on the send box. + await pageObjects.focusSendBoxTextBox(); - // GIVEN: All `ac-actionSet` should have `[role="menubar"]`. - Array.from(document.querySelectorAll('.ac-actionSet')).every(actionSet => - expect(actionSet.getAttribute('role')).toBe('menubar') - ); + // SETUP: There should be 2 set of `ac-actionSet` containers. + expect(document.querySelectorAll('.ac-actionSet')).toHaveLength(2); - // GIVEN: All 'ac-pushButton' should not have "aria-pressed". + // SETUP: All 'ac-pushButton' should not have `aria-pressed="true"`. Array.from(document.querySelectorAll('.ac-pushButton')).every(pushButton => - expect(pushButton.hasAttribute('aria-pressed')).toBe(false) + expect(pushButton.hasAttribute('aria-pressed')).not.toBe('true') ); - // GIVEN: The page should conform to WCAG. - expectWCAGConformity(); - // WHEN: Clicking on the card action button ("Submit card"). - await host.click( - Array.from(document.getElementsByClassName('ac-pushButton')).find( - pushButton => pushButton.innerText === 'Submit card' - ) - ); - - // THEN: The first `ac-actionSet` should have `[role="menubar"]` untouched. - expect(document.querySelectorAll('.ac-actionSet')[0].getAttribute('role')).toBe('menubar'); - - // THEN: The second `ac-actionSet` should have `[role="menubar"]` removed. - expect(document.querySelectorAll('.ac-actionSet')[1].hasAttribute('role')).toBe(false); + await host.sendShiftTab(3); + await host.sendKeys('ENTER', 'TAB', 'TAB', 'ENTER'); // THEN: Selected `ac-pushButton` should have `aria-pressed` set to `true`. Array.from(document.querySelectorAll('.ac-pushButton')) @@ -171,20 +137,11 @@ // THEN: Non-selection should not have `aria-pressed` set. Array.from(document.querySelectorAll('.ac-pushButton')) .filter(pushButton => pushButton.innerText !== 'Submit card') - .forEach(pushButton => expect(pushButton.hasAttribute('aria-pressed')).toBeFalsy()); - - // THEN: The page should conform to WCAG. - expectWCAGConformity(); + .forEach(pushButton => expect(pushButton.getAttribute('aria-pressed')).not.toBe('true')); // WHEN: Click on the first action set button ("Yes") - await host.click( - Array.from(document.getElementsByClassName('ac-pushButton')).find( - pushButton => pushButton.innerText === 'Yes' - ) - ); - - // THEN: The first `ac-actionSet` should have `[role="menubar"]` removed. - expect(document.querySelectorAll('.ac-actionSet')[0].hasAttribute('role')).toBe(false); + await host.sendShiftTab(2); + await host.sendKeys('ENTER'); // THEN: Selected `ac-pushButton` should have `aria-pressed` set to `true`. Array.from(document.querySelectorAll('.ac-pushButton')) @@ -197,9 +154,6 @@ pushButton => pushButton.getAttribute('aria-pressed') === 'true' ) ).toHaveLength(2); - - // THEN: The page should conform to WCAG. - expectWCAGConformity(); });
+ + +diff --git a/__tests__/html/accessibility.adaptiveCard.disabled.focus.withShowCard.html b/__tests__/html/accessibility.adaptiveCard.disabled.focus.withShowCard.html new file mode 100644 index 0000000000..86050b030a --- /dev/null +++ b/__tests__/html/accessibility.adaptiveCard.disabled.focus.withShowCard.html @@ -0,0 +1,198 @@ + + +
+ + + + + + +
+