Skip to content

Commit c8b273f

Browse files
authored
WB-1672: Form fields: Update border color to offBlack50 (#2199)
## Summary: For a11y reasons, we are changing the border color from `offBlack16` to `offBlack50`. This will solve a color contrast issue for non-text elements like textfields and dropdown openers. This PR updates this color in `TextField`, `MultiSelect` and `SingleSelect` to match these changes. TextField / LabeledTextField: <img width="942" alt="Screenshot 2024-03-15 at 10 18 25 AM" src="https://github.com/Khan/wonder-blocks/assets/843075/94d92afa-d15d-4b1d-9539-6e815192d86b"> MultiSelect / SingleSelect: <img width="761" alt="Screenshot 2024-03-15 at 10 18 49 AM" src="https://github.com/Khan/wonder-blocks/assets/843075/da4a7126-c899-48de-aae7-c4c368eecd60"> Issue: WB-1672 ## Test plan: Verify the border color of the `Textfield`, `MultiSelect` and `SingleSelect` in Storybook and chromatic, and ensure that the color looks as we expect. Author: jandrade Reviewers: jandrade, jeresig Required Reviewers: Approved By: jeresig Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ codecov/project, ✅ Lint (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ⏭️ Chromatic - Skip on Release PR (changesets), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ⏭️ dependabot Pull Request URL: #2199
1 parent 4bc4e3d commit c8b273f

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

.changeset/dirty-badgers-fry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@khanacademy/wonder-blocks-dropdown": patch
3+
---
4+
5+
Update default/resting border color to fix a color contrast issue

.changeset/eight-rice-hear.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@khanacademy/wonder-blocks-form": patch
3+
---
4+
5+
Update default/resting border color to fix a color contrast issue

__docs__/wonder-blocks-form/labeled-text-field.stories.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ import packageConfig from "../../packages/wonder-blocks-form/package.json";
1515
import ComponentInfo from "../../.storybook/components/component-info";
1616
import LabeledTextFieldArgTypes from "./labeled-text-field.argtypes";
1717

18+
/**
19+
* A LabeledTextField is an element used to accept a single line of text from
20+
* the user paired with a label, description, and error field elements.
21+
*/
1822
export default {
1923
title: "Packages / Form / LabeledTextField",
2024
component: LabeledTextField,

__docs__/wonder-blocks-form/text-field.stories.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import packageConfig from "../../packages/wonder-blocks-form/package.json";
1414
import ComponentInfo from "../../.storybook/components/component-info";
1515
import TextFieldArgTypes from "./text-field.argtypes";
1616

17+
/**
18+
* A TextField is an element used to accept a single line of text from the user.
19+
*/
1720
export default {
1821
title: "Packages / Form / TextField",
1922
component: TextField,

packages/wonder-blocks-dropdown/src/components/select-opener.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ const _generateStyles = (
322322
newStyles = {
323323
default: {
324324
background: error ? tokens.color.fadedRed8 : tokens.color.white,
325-
borderColor: error ? tokens.color.red : tokens.color.offBlack16,
325+
borderColor: error ? tokens.color.red : tokens.color.offBlack50,
326326
borderWidth: tokens.border.width.hairline,
327327
color: placeholder
328328
? tokens.color.offBlack64
@@ -334,7 +334,7 @@ const _generateStyles = (
334334
":hover:not([aria-disabled=true])": {
335335
borderColor: error
336336
? tokens.color.red
337-
: tokens.color.offBlack16,
337+
: tokens.color.offBlack50,
338338
borderWidth: tokens.border.width.hairline,
339339
paddingLeft: tokens.spacing.medium_16,
340340
paddingRight: tokens.spacing.small_12,

packages/wonder-blocks-form/src/components/text-field.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from "react";
22
import {StyleSheet} from "aphrodite";
33

4-
import {mix, color, spacing} from "@khanacademy/wonder-blocks-tokens";
54
import {IDProvider, addStyle} from "@khanacademy/wonder-blocks-core";
5+
import {color, spacing} from "@khanacademy/wonder-blocks-tokens";
66
import {styles as typographyStyles} from "@khanacademy/wonder-blocks-typography";
77

88
import type {StyleType, AriaProps} from "@khanacademy/wonder-blocks-core";
@@ -329,14 +329,14 @@ const styles = StyleSheet.create({
329329
},
330330
default: {
331331
background: color.white,
332-
border: `1px solid ${color.offBlack16}`,
332+
border: `1px solid ${color.offBlack50}`,
333333
color: color.offBlack,
334334
"::placeholder": {
335335
color: color.offBlack64,
336336
},
337337
},
338338
error: {
339-
background: `${mix(color.fadedRed8, color.white)}`,
339+
background: color.fadedRed8,
340340
border: `1px solid ${color.red}`,
341341
color: color.offBlack,
342342
"::placeholder": {

0 commit comments

Comments
 (0)