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

Red border not showing for error/invalid fields #244

Open
evadecker opened this issue Nov 30, 2024 · 2 comments
Open

Red border not showing for error/invalid fields #244

evadecker opened this issue Nov 30, 2024 · 2 comments
Labels
bug Something isn't working frontend CSS, HTML, and JS changes good first issue Good for newcomers
Milestone

Comments

@evadecker
Copy link
Member

Describe the bug
When a field has an error/invalid state, its border should be red.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any form with required fields (like sign in)
  2. Attempt to submit the form without data
  3. View the error state for the field
  4. No red border is displayed

Expected behavior
A red border should display.

Screenshots
CleanShot 2024-11-29 at 22 06 36@2x

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome

Additional context
Invalid styles are set for fields, but something about the current composition of components in React Aria is preventing those styles from applying. Figure out what is wrong.

@evadecker evadecker added bug Something isn't working good first issue Good for newcomers frontend CSS, HTML, and JS changes labels Nov 30, 2024
@evadecker evadecker added this to the Namesake GA milestone Nov 30, 2024
@belhajManel
Copy link
Contributor

After some investigation, I discovered that the issue with the invalid state showing a purple border instead of a red one is caused by the focusRing utility overriding the invalid styles.

Root Cause:

  • The focusRing utility applies a purple outline when the field is focused (isFocusVisible: true).
  • This behavior conflicts with the isInvalid state styles defined in fieldBorderStyles, resulting in the purple outline taking precedence over the red border.

I'll try to dig deeper into this issue.

@evadecker
Copy link
Member Author

After some investigation, I discovered that the issue with the invalid state showing a purple border instead of a red one is caused by the focusRing utility overriding the invalid styles.

Root Cause:

  • The focusRing utility applies a purple outline when the field is focused (isFocusVisible: true).

  • This behavior conflicts with the isInvalid state styles defined in fieldBorderStyles, resulting in the purple outline taking precedence over the red border.

I'll try to dig deeper into this issue.

Thanks for investigating @belhajManel! Both the border and outline should be able to apply, so I wonder what's going wrong... 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend CSS, HTML, and JS changes good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants