cfpb / design-system-react

A React/Storybook implementation of CFPB's Design System
https://cfpb.github.io/design-system-react/
MIT License
6 stars 4 forks source link

DS/DSR Hover and Focus styling | Text input/Checkbox/Radio button/Selects #357

Open natalia-fitzgerald opened 3 months ago

natalia-fitzgerald commented 3 months ago

Exploration

I am looking to explore the following approach to the hover and focus styling for input fields.

Proposal

Status Base Hover Focus
Enabled Border: 1px, Gray 60 (#919395) Border: 2px, Pacific (#0072ce) Border: 2px, Pacific (#0072ce) and Outline: Dotted 1px, Pacific (#0072ce)
Disabled Border: 1px, Gray 60 (#919395) and Background: Gray 10 (#e7e8e9) Cursor change None
Success Border: 2px, Green (#20aa3f) Border: 2px, Pacific (#0072ce) Border: 2px, Pacific (#0072ce) and Outline: Dotted 1px, Pacific (#0072ce)
Warning Border: 2px, Gold (#ff9e1b) Border: 2px, Pacific (#0072ce) Border: 2px, Pacific (#0072ce) and Outline: Dotted 1px, Pacific (#0072ce)
Error Border: 2px, Red (#d14124) Border: 2px, Pacific (#0072ce) Border: 2px, Pacific (#0072ce) and Outline: Dotted 1px, Pacific (#0072ce)

Audit of current state

In the CFPB Design System (and therefore the DSR) The current approach to hover and focus colors is inconsistently implemented. For some inputs we mirror status colors for hover and focus and for others we use Pacific blue.

I would like to audit the landscape of what we currently do in order to then make a decision as to what we might want to do moving forward. This change would likely start at the DS and then reach the DSR and our app. My goal is to reduce the maintenance burden, increase consistency, implement state and status styling across components, and make our form inputs more usable.

Checkboxes

DS DS
Screenshot 2024-05-24 at 4 36 07 PM Screenshot 2024-05-24 at 4 36 24 PM

Text input/Text area

DS DS
Screenshot 2024-05-24 at 4 44 10 PM Screenshot 2024-05-24 at 4 44 20 PM

Select

DS
Screenshot 2024-05-24 at 4 48 32 PM

Radio buttons

DS
Screenshot 2024-05-24 at 4 51 13 PM

@meissadia @shindigira - Are the status state styles for select, multi-select, and radio buttons defined in the DS or DSR

meissadia commented 3 months ago

@natalia-fitzgerald Re: status styles - Radio/Select in DSR do not currently implement a status or state property, so I imagine @shindigira is achieving these styles via DS classes.

natalia-fitzgerald commented 3 months ago

@meissadia I'm hoping to simplify our styling, starting at the source (DS). The purpose of this issue is to get a better idea of the current state so that I can make a case for greater consistency. I think that using Pacific for hover and focus sounds like a promising solution.

Sigmund opened an ticket for a styling issue with the error status for the Select component.https://github.com/cfpb/sbl-frontend/issues/561

itsmedavep commented 3 months ago

I like the approach of keeping the hover state the same across status'. I believe that helps to keep things consistent while also reducing the amount of styles for the various status.

I guess the only open question in my mind would be what are all of the components the status styling be introduced to.

Is it the list above? Are there additional ones (EG text area)?

Regardless this seems like a good starting point.

natalia-fitzgerald commented 3 months ago

@itsmedavep Thanks for your feedback. I added text area input to the list at the top.

So the components which should have status states are:

For the purposes of this initial effort we would prioritize the components which appear in the data submission platform:

The following do not appear in the data submission platform:

Another question I have, which is out of scope but related, is whether we may want to consider applying this approach (Pacific hover and focus) to other interactive elements, like buttons and links.

But yes, as a first step I'd like to confirm that this approach is appealing to the team and if so we will begin to update the input components that appear on the data submission platform first.