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

feat(listbox-button): added error state #2244

Merged
merged 4 commits into from
Jan 12, 2024
Merged

Conversation

ArtBlue
Copy link
Contributor

@ArtBlue ArtBlue commented Jan 9, 2024

Fixes #2063

  • This PR contains CSS changes
  • This PR does not contain CSS changes

Description

This adds error state support for listbox-button as well as its broader support in field with an associated error message.

Notes

This is the first phase of support for error state. The next issue/PR will add it for textbox and include the error message icon as well. The future message module will later extend both.

We can't run visual regression at the moment since Percy's on the fritz.

Screenshots

Listbox Button Before

image

Listbox Button After

image

Field Listbox Button After

image

Checklist

  • I verify the build is in a non-broken state
  • I verify all changes are within scope of the linked issue
  • I regenerated all CSS files under dist folder
  • I tested the UI in all supported browsers
  • I did a visual regression check of the components impacted by doing a Percy build and approved the build
  • I tested the UI in dark mode and RTL mode
  • I added/updated/removed Storybook coverage as appropriate

@ArtBlue ArtBlue self-assigned this Jan 9, 2024
.listbox-button button.btn--form:active {
.listbox-button:not(.listbox-button--error) button.btn--form:hover,
.listbox-button:not(.listbox-button--error) button.btn--form:focus,
.listbox-button:not(.listbox-button--error) button.btn--form:active {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, Im wondering. Do we need the :not?
The way I see it, if we do not have the error class then we should show the default color. If the error class is present, that should be a stronger style match and it should take precedence, right?

.listbox-button button.btn--form:hover { }
.listbox-button.listbox-button--error button.btn--form:hover { }

That should be stronger right?
Just wondering so we can simplify things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I changed the default to exclude error because it seemed odd that a focused hover/active/focus would remove the state indication; it would remove an important visual cue that there's an error on the listbox.

I suppose we can add another style block to override the default, but that would mean more code and explicit style application. I actually don't see how these error states were intended to work with hover/active/focus to begin with; I don't see anything in Figma. I'll reach out to DS as they'll probably need to provide the colors to use in this states.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, lets leave it. I see what the issue is, we don't have a hover state for error. If we did that means we dont need this.
Lets add a comment to those lines to remove them when we get an error state. Otherwise LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that having a focus state that didn't change color was likely an a11y issue so I just reverted this and made the styling match textbox. We can apply the additional colors if/when we get them.

@ArtBlue ArtBlue merged commit abc9380 into 17.1.0 Jan 12, 2024
1 check passed
@ArtBlue ArtBlue deleted the 2063-listbox-error-state branch January 12, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants