Skip to content

Input validation: red border - #3724

Closed
math-GH wants to merge 8 commits into
FreshRSS:edgefrom
math-GH:3647-form-red-border-invalid
Closed

math-GH wants to merge 8 commits into
FreshRSS:edgefrom
math-GH:3647-form-red-border-invalid

Conversation

@math-GH

@math-GH math-GH commented Jul 26, 2021 •

Copy link
Copy Markdown
Contributor

Closes #3647

Changes proposed in this pull request:

How to test the feature manually:

  1. go to an form with empty mandatory input (f.e. "Add a feed or category" or "Manage Users"

(tested with Firefox 90 and Microsoft Edge on Windows 10)

Pull request checklist:

  • clear commit messages
  • code manually tested
  • unit tests written (optional if too hard)
  • documentation updated

@Frenzie

Frenzie commented Jul 26, 2021

Copy link
Copy Markdown
Member

I see your point, but I'm not sure if only on focus is necessarily the solution. On the flip side, maybe it's good enough when combined with :user-invalid so that a more desirable behavior will automatically appear in the future.
https://drafts.csswg.org/selectors/#user-invalid-pseudo

@math-GH

math-GH commented Jul 26, 2021

Copy link
Copy Markdown
Contributor Author

I see your point, but I'm not sure if only on focus is necessarily the solution. On the flip side, maybe it's good enough when combined with :user-invalid so that a more desirable behavior will automatically appear in the future.
https://drafts.csswg.org/selectors/#user-invalid-pseudo

I checked it already: user-invalid works only in Firefox :(
https://caniuse.com/?search=user-invalid

Comment thread p/themes/Origine/origine.css Resolved
@Alkarex Alkarex added this to the 1.19.0 milestone Jul 26, 2021
@Alkarex Alkarex added the UI 🎨 User Interfaces label Jul 26, 2021
Comment thread p/themes/Origine/origine.rtl.css Resolved

@Frenzie Frenzie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, unless we want to involve some script

Right now this only works completely as intended in the latest versions of Firefox, but other browsers will presumably implement it in the near future.

@Alkarex

Alkarex commented Aug 4, 2021

Copy link
Copy Markdown
Member

I suggest we wait a bit to see this syntax implemented in one more browser or moved from draft to Candidate Recommendation (CR) at least
https://developer.mozilla.org/docs/Web/CSS/:user-invalid

@Alkarex Alkarex removed this from the 1.19.0 milestone Aug 4, 2021
@Frenzie

Frenzie commented Aug 4, 2021

Copy link
Copy Markdown
Member

The status is for the whole document, but if you prefer.

@math-GH
math-GH marked this pull request as draft August 31, 2021 09:52
@math-GH

math-GH commented Nov 15, 2021

Copy link
Copy Markdown
Contributor Author

closed. I still hate the red borders.

@math-GH math-GH closed this Nov 15, 2021
@math-GH
math-GH deleted the 3647-form-red-border-invalid branch November 15, 2021 21:29
Elgeryy1 pushed a commit to Elgeryy1/FreshRSS that referenced this pull request Jul 15, 2026
Every theme styled required inputs and selects with :invalid, which
matches as soon as an empty required field renders, before the user
has even touched it. This made fields such as the username on the
"Add user" admin form show a red border on first load, with nothing
wrong yet.

Switch to :user-invalid, which only matches after the user has
interacted with the field (e.g. on blur or submit), so a field only
turns red once it is actually flagged as invalid by the user's own
input. Browser support for :user-invalid is now good enough across
evergreen browsers (~89%, per caniuse) for this to be safe, which
was the blocker that stopped a previous attempt at this fix in FreshRSS#3724.

Fixes FreshRSS#3647
Alkarex added a commit that referenced this pull request Jul 18, 2026
* Use :user-invalid instead of :invalid for form field styling

Every theme styled required inputs and selects with :invalid, which
matches as soon as an empty required field renders, before the user
has even touched it. This made fields such as the username on the
"Add user" admin form show a red border on first load, with nothing
wrong yet.

Switch to :user-invalid, which only matches after the user has
interacted with the field (e.g. on blur or submit), so a field only
turns red once it is actually flagged as invalid by the user's own
input. Browser support for :user-invalid is now good enough across
evergreen browsers (~89%, per caniuse) for this to be safe, which
was the blocker that stopped a previous attempt at this fix in #3724.

Fixes #3647

* CSS: support legacy Gecko invalid styles

* Drop legacy -moz-ui-invalid
Not important enough

---------

Co-authored-by: Gerard Alvear <[email protected]>
Co-authored-by: Alexandre Alapetite <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI 🎨 User Interfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] New user: input is always red, when empty

3 participants