Skip to content

Commit d9dc1c1

Browse files
authored
refactor: using :user-*valid from now on (#936)
1 parent cf81ce4 commit d9dc1c1

File tree

10 files changed

+15
-17
lines changed

10 files changed

+15
-17
lines changed

source/_patterns/01-elements/_form-elements.scss

+6-8
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,12 @@
9494
// TODO: maybe we could totally restructure this, work with a :not(select) instead, differentiate in between user-invalid and provide a fallback (https://github.com/db-ui/mono/pull/893), etc.
9595
%form-element-validation {
9696
&:not([aria-invalid]) {
97-
&:not(:placeholder-shown) {
98-
&:valid {
99-
--formElement---borderColor: #{$db-color-green-600};
100-
}
101-
102-
&:invalid {
103-
--formElement---borderColor: #{$db-color-red-500};
104-
}
97+
&:user-valid {
98+
--formElement---borderColor: #{$db-color-green-600};
99+
}
100+
101+
&:user-invalid {
102+
--formElement---borderColor: #{$db-color-red-500};
105103
}
106104
}
107105
}

source/_patterns/01-elements/input/_input.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The attribute doesn't even only take boolean values, but even also a list of spe
2424

2525
Please have a look especially at the section for form validation within the overall [components/forms](../components-form/index.html) page.
2626

27-
Additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
27+
Additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
2828

2929
## Accessibility support
3030

source/_patterns/01-elements/input/input~invalid-attribute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ order: 7
88

99
Please have a look especially at the section for form validation within the overall [components/forms](../components-form/index.html) page.
1010

11-
Additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
11+
Additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.

source/_patterns/01-elements/radio/_radio.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ state: complete
77

88
Please have a look especially at the section for form validation within the overall [components/forms](../components-form/index.html) page.
99

10-
Additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
10+
Additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
1111

1212
[inspirational sources for this page]: # "https://www.uiguideline.com/components/radio"

source/_patterns/01-elements/radio/radio.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
&:checked {
4848
border-width: to-em($pxValue: 6);
4949
}
50-
// * the invalid style using the :invalid pseudo class (and [aria-invalid="true"] equivalent, see #136 and #141)
50+
// * the invalid style using the :user-invalid pseudo class (and [aria-invalid="true"] equivalent, see #136 and #141)
5151
&:is(:user-invalid),
5252
&[aria-invalid="true"] {
5353
border-color: #c13e34;

source/_patterns/01-elements/select/_select.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ If you would like to even also match those visual requirements, you would need t
1313

1414
Please have a look especially at the section for form validation within the overall [components/forms](../components-form/index.html) page.
1515

16-
Additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
16+
Additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
1717

1818
[inspirational sources for this page]: # "https://www.uiguideline.com/components/select-dropdown"

source/_patterns/01-elements/select/select~invalid-attribute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ order: 7
88

99
Please have a look especially at the section for form validation within the overall [components/forms](../components-form/index.html) page.
1010

11-
Additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
11+
Additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.

source/_patterns/01-elements/textarea/_textarea.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ state: complete
77

88
Please have a look especially at the section for form validation within the overall [components/forms](../components-form/index.html) page.
99

10-
Additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
10+
Additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
1111

1212
[inspirational sources for this page]: # "https://www.uiguideline.com/components/textarea"

source/_patterns/01-elements/textarea/textarea~invalid-attribute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ order: 7
88

99
Please have a look especially at the section for form validation within the overall [components/forms](../components-form/index.html) page.
1010

11-
Additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.
11+
Additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) as well.

source/_patterns/02-components/form/_form.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ It's best to use the built-in and standard form validation, as these are standar
2424

2525
Additionally this way you're following the principles of Progressive Enhancement - and in other words, any JavaScript only solution doesn't provide a graceful degradation and puts that whole functionality to the weakest layer in the stack even only.
2626

27-
Nevertheless additionally to the browser built-in pseudo-selector `:invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) on the elements `input`, `radio`, `select` and `textarea`.
27+
Nevertheless additionally to the browser built-in pseudo-selector `:user-invalid` we're providing styling for the [`aria-invalid="true"` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) on the elements `input`, `radio`, `select` and `textarea`.
2828
We can't toggle any given/static attribute in the DB UI Core product itself, as we don't want to use JavaScript in this basic product. As you'd also need to add individual error messages, please find some inspiration on the necessary HTML code implementation e.g. on <http://mars.dequecloud.com/demo/form-alert3.htm>
2929

3030
Please find some more informations on the following pages:

0 commit comments

Comments
 (0)