Skip to content

Commit be67477

Browse files
authored
High contrast: push button should be highlighted (#4746)
* High contrast: push button should be highlighted * Add entry * Update snapshot
1 parent b7f2de1 commit be67477

6 files changed

Lines changed: 88 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2222

2323
## [Unreleased]
2424

25+
### Fixed
26+
27+
- 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)
28+
2529
## [4.15.8] - 2023-06-06
2630

2731
### Breaking changes
-10 Bytes
Loading
Loading
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<script crossorigin="anonymous" src="/test-harness.js"></script>
6+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
7+
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
8+
</head>
9+
<body>
10+
<main id="webchat"></main>
11+
<script>
12+
run(
13+
async function () {
14+
const { directLine, store } = testHelpers.createDirectLineEmulator();
15+
16+
await host.sendDevToolsCommand('Emulation.setEmulatedMedia', {
17+
features: [{ name: 'forced-colors', value: 'active' }]
18+
});
19+
20+
WebChat.renderWebChat(
21+
{
22+
directLine,
23+
store
24+
},
25+
document.getElementById('webchat')
26+
);
27+
28+
await pageConditions.uiConnected();
29+
30+
await directLine.emulateIncomingActivity({
31+
type: 'message',
32+
text: '',
33+
attachmentLayout: 'carousel',
34+
attachments: [
35+
{
36+
contentType: 'application/vnd.microsoft.card.hero',
37+
content: {
38+
title: 'Details about image 1',
39+
subtitle: 'This is the subtitle',
40+
text: 'Price: $XXX.XX USD',
41+
buttons: [
42+
{
43+
type: 'imBack',
44+
value: 'Place to buy',
45+
title: 'Places To Buy'
46+
},
47+
{
48+
type: 'imBack',
49+
value: 'Related Products',
50+
title: 'Related Products'
51+
}
52+
]
53+
}
54+
}
55+
]
56+
});
57+
58+
await pageConditions.numActivitiesShown(1);
59+
60+
(await directLine.actPostActivity(() => host.click(document.querySelector('.ac-pushButton')))).resolveAll();
61+
62+
await pageConditions.numActivitiesShown(2);
63+
await pageConditions.allOutgoingActivitiesSent();
64+
65+
await host.snapshot();
66+
},
67+
{ ignoreErrors: 'artificial error' }
68+
);
69+
</script>
70+
</body>
71+
</html>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */
2+
3+
describe('In high contrast mode', () => {
4+
test('hero card with buttons pushed should be highlighted', () => runHTML('highContrast.heroCard.pushButton.html'));
5+
});

packages/bundle/src/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ export default function ({
7373
'& .ac-pushButton[aria-pressed="true"]': {
7474
backgroundColor: cardPushButtonBackgroundColor,
7575
borderColor: cardPushButtonBackgroundColor,
76-
color: cardPushButtonTextColor
76+
color: cardPushButtonTextColor,
77+
78+
'@media (forced-colors: active)': {
79+
backgroundColor: 'Highlight',
80+
borderColor: 'Highlight',
81+
color: 'HighlightText',
82+
forcedColorAdjust: 'none'
83+
}
7784
},
7885

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

0 commit comments

Comments
 (0)