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

High contrast: push button should be highlighted #4746

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Fixes [#4718](https://github.com/microsoft/BotFramework-WebChat/issues/4718). In high contrast mode, Adaptive Card buttons, when pushed, should highlighted properly, by [@compulim](https://github.com/compulim), in PR [#4746](https://github.com/microsoft/BotFramework-WebChat/pull/4746)

## [4.15.8] - 2023-06-06

### Breaking changes
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions __tests__/html/highContrast.heroCard.pushButton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!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>
<main id="webchat"></main>
<script>
run(
async function () {
const { directLine, store } = testHelpers.createDirectLineEmulator();

await host.sendDevToolsCommand('Emulation.setEmulatedMedia', {
features: [{ name: 'forced-colors', value: 'active' }]
});

WebChat.renderWebChat(
{
directLine,
store
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

await directLine.emulateIncomingActivity({
type: 'message',
text: '',
attachmentLayout: 'carousel',
attachments: [
{
contentType: 'application/vnd.microsoft.card.hero',
content: {
title: 'Details about image 1',
subtitle: 'This is the subtitle',
text: 'Price: $XXX.XX USD',
buttons: [
{
type: 'imBack',
value: 'Place to buy',
title: 'Places To Buy'
},
{
type: 'imBack',
value: 'Related Products',
title: 'Related Products'
}
]
}
}
]
});

await pageConditions.numActivitiesShown(1);

(await directLine.actPostActivity(() => host.click(document.querySelector('.ac-pushButton')))).resolveAll();

await pageConditions.numActivitiesShown(2);
await pageConditions.allOutgoingActivitiesSent();

await host.snapshot();
},
{ ignoreErrors: 'artificial error' }
);
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions __tests__/html/highContrast.heroCard.pushButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('In high contrast mode', () => {
test('hero card with buttons pushed should be highlighted', () => runHTML('highContrast.heroCard.pushButton.html'));
});
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ export default function ({
'& .ac-pushButton[aria-pressed="true"]': {
backgroundColor: cardPushButtonBackgroundColor,
borderColor: cardPushButtonBackgroundColor,
color: cardPushButtonTextColor
color: cardPushButtonTextColor,

'@media (forced-colors: active)': {
backgroundColor: 'Highlight',
borderColor: 'Highlight',
color: 'HighlightText',
forcedColorAdjust: 'none'
}
},

'& input[aria-disabled="true"]': {
Expand Down