Skip to content

Commit

Permalink
Fixed sendBox input/textarea background color issue (#2111)
Browse files Browse the repository at this point in the history
* Fixed sendBox input/textarea background color issue

* Updated CHANGELOG.md

* Removed changes to sample
  • Loading branch information
tdurnford authored and corinagum committed Jun 23, 2019
1 parent f1f5185 commit 4d79436
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix [#2001](https://github.com/Microsoft/BotFramework-WebChat/issues/2001). Strip Markdown from ARIA labels, so screen readers do not speak Markdown in text, by [@corinagum](https://github.com/corinagum) in PR [#2096](https://github.com/Microsoft/BotFramework-WebChat/pull/2096)
- Fix [#1926](https://github.com/microsoft/BotFramework-WebChat/issues/1926). Fixed scroll stickiness issue when submitting an Adaptive Card form with suggested actions opened, by [@compulim](https://github.com/compulim) in PR [#2107](https://github.com/microsoft/BotFramework-WebChat/pull/2107)
- Fix [#2106](https://github.com/Microsoft/BotFramework-WebChat/issues/2016). Fix AdaptiveCardHostConfig warning associated with the CommonCard component, by [@tdurnford](https://github.com/tdurnford) in PR [#2108](https://github.com/Microsoft/BotFramework-WebChat/pull/2108)
- Fix [#2110](https://github.com/Microsoft/BotFramework-WebChat/issues/2110). Fixed sendBox input/textarea background color issue, by [@tdurnford](https://github.com/johndoe) in PR [#2111](https://github.com/Microsoft/BotFramework-WebChat/pull/2111)

### Samples

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions __tests__/input.js
Expand Up @@ -4,6 +4,7 @@ import { imageSnapshotOptions, timeouts } from './constants.json';

import allOutgoingActivitiesSent from './setup/conditions/allOutgoingActivitiesSent';
import minNumActivitiesShown from './setup/conditions/minNumActivitiesShown.js';
import uiConnected from './setup/conditions/uiConnected';

// selenium-webdriver API doc:
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html
Expand Down Expand Up @@ -113,3 +114,42 @@ test('textarea long text', async () => {

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

test('text box input background color', async () => {
const props = {
styleOptions: {
sendBoxBackground: '#0063B1',
sendBoxTextColor: 'White',
sendBoxButtonColor: 'White',
sendBoxPlaceholderColor: 'White'
}
};

const { driver } = await setupWebDriver({ props });

await driver.wait(uiConnected(), timeouts.directLine);

const base64PNG = await driver.takeScreenshot();

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

test('text area input background color', async () => {
const props = {
styleOptions: {
sendBoxBackground: '#0063B1',
sendBoxTextColor: 'White',
sendBoxButtonColor: 'White',
sendBoxPlaceholderColor: 'White',
sendBoxTextWrap: true
}
};

const { driver } = await setupWebDriver({ props });

await driver.wait(uiConnected(), timeouts.directLine);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});
9 changes: 8 additions & 1 deletion packages/component/src/Styles/StyleSet/SendBoxTextArea.js
@@ -1,7 +1,9 @@
export default function createSendBoxTextAreaStyle({
paddingRegular,
primaryFont,
sendBoxBackground,
sendBoxMaxHeight,
sendBoxPlaceholderColor,
sendBoxTextColor
}) {
return {
Expand Down Expand Up @@ -33,6 +35,7 @@ export default function createSendBoxTextAreaStyle({
},

'& > textarea': {
backgroundColor: sendBoxBackground,
border: 0,
color: 'inherit',
fontFamily: 'inherit',
Expand All @@ -45,7 +48,11 @@ export default function createSendBoxTextAreaStyle({
resize: 'none',
top: 0,
width: '100%',
wordBreak: 'break-word'
wordBreak: 'break-word',

'&::placeholder': {
color: sendBoxPlaceholderColor
}
}
}
};
Expand Down
14 changes: 12 additions & 2 deletions packages/component/src/Styles/StyleSet/SendBoxTextBox.js
@@ -1,16 +1,26 @@
export default function createSendBoxTextBoxStyle({ primaryFont, sendBoxTextColor }) {
export default function createSendBoxTextBoxStyle({
primaryFont,
sendBoxBackground,
sendBoxPlaceholderColor,
sendBoxTextColor
}) {
return {
alignItems: 'center',
fontFamily: primaryFont,

'& > input': {
backgroundColor: sendBoxBackground,
border: 0,
color: sendBoxTextColor,
fontFamily: 'inherit',
fontSize: 'inherit',
height: '100%',
outline: 0,
padding: 0
padding: 0,

'&::placeholder': {
color: sendBoxPlaceholderColor
}
}
};
}
1 change: 1 addition & 0 deletions packages/component/src/Styles/defaultStyleOptions.js
Expand Up @@ -69,6 +69,7 @@ const DEFAULT_OPTIONS = {
sendBoxBorderLeft: '',
sendBoxBorderRight: '',
sendBoxBorderTop: 'solid 1px #E6E6E6',
sendBoxPlaceholderColor: '#767676',
sendBoxTextWrap: false,

// Visually show spoken text
Expand Down

0 comments on commit 4d79436

Please sign in to comment.