-
Notifications
You must be signed in to change notification settings - Fork 1
feat(forms): add .sf-live-validate — opt-in native validation feedback #604
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,34 @@ | |
| } | ||
| /* stylelint-enable selector-pseudo-class-no-unknown */ | ||
|
|
||
| /* Opt-in native validation feedback. Unconditional :user-invalid/:user-valid | ||
| styling was removed in 0.8.0 (see docs/migration.md): it fires on simple | ||
| focus+blur, so a still-empty required field could be marked invalid mid | ||
| multi-field form-fill, before any submit was attempted — the pattern | ||
| Bootstrap's own .was-validated gate exists to avoid. .sf-live-validate is | ||
| that same gate: put it on a <form> or <fieldset> to scope the pivot to | ||
| that subtree, so it only lights up on a real submit attempt (or explicit | ||
| interaction) instead of applying everywhere by default. | ||
|
|
||
| Safe to combine with manual validation: .sf-is-invalid/.sf-is-valid | ||
| (core/states.css, @layer slashed.states) always win over the rules below | ||
| regardless of selector specificity, because slashed.states is declared | ||
| AFTER slashed.forms in the layer order (core/layers.css) — cascade layer | ||
| order beats specificity. A field you've manually marked .sf-is-invalid | ||
| (e.g. a server-side error) can't be silently un-coloured by these rules | ||
| even if the browser considers it natively valid. */ | ||
| .sf-live-validate input:user-invalid, | ||
| .sf-live-validate select:user-invalid, | ||
| .sf-live-validate textarea:user-invalid { | ||
| --sf-field-border-color: var(--sf-color-danger); | ||
| } | ||
|
|
||
| .sf-live-validate input:user-valid, | ||
| .sf-live-validate select:user-valid, | ||
| .sf-live-validate textarea:user-valid { | ||
| --sf-field-border-color: var(--sf-color-success); | ||
| } | ||
|
Comment on lines
+89
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Context Used: CLAUDE.md (source) Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Comment on lines
+105
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new rules have specificity |
||
|
|
||
| /* Numeric inputs */ | ||
| input[type="number"] { | ||
| font-variant-numeric: var(--sf-font-numeric, tabular-nums); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: codeslash-dev/SLASHED
Length of output: 655
🏁 Script executed:
Repository: codeslash-dev/SLASHED
Length of output: 10362
Document
.sf-live-validateindocs/llm-guide.mdoptional/forms.cssnow makes native validation feedback opt-in. Add the new.sf-live-validategate and the removed unconditional:user-invalid/:user-validbehavior to the guide so the forms docs match the shipped behavior.🤖 Prompt for AI Agents
Source: Coding guidelines