You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<lidata-visibledata-error-type="error_1">ad-hoc error message 1 <small>(rendered on initial load)</small></li>
85
-
<lidata-preservedata-error-type="tooShort">Custom Preserved Error: Must be at least 4 characters<small>(rendered on initial load)</small></li>
84
+
<lidata-pf-error-visibledata-pf-error-type="error_1">ad-hoc error message 1 <small>(rendered on initial load)</small></li>
85
+
<lidata-pf-error-preservedata-pf-error-type="tooShort">Custom Preserved Error: Must be at least 4 characters<small>(rendered on initial load)</small></li>
- `data-error-type`: Theerrortypeforthislistitem (eg: `tooShort`, or `some_custom_error_type`)
156
-
- `data-preserve`: Thiserrorlistitemshouldnotberemovedwhenclearingtheerrorlist; useful for rendering custom error messages for default error types. *Just because an error is preserved does not mean it is visible*
157
-
- `data-error-message` Used in the error list item `template` element to indicate where an error message should be rendered in the markup as the `textContent`
- `data-pf-error-type`: Theerrortypeforthislistitem (eg: `tooShort`, or `some_custom_error_type`)
156
+
- `data-pf-error-preserve`: Thiserrorlistitemshouldnotberemovedwhenclearingtheerrorlist; useful for rendering custom error messages for default error types. *Just because an error is preserved does not mean it is visible*
157
+
- `data-pf-error-message` Used in the error list item `template` element to indicate where an error message should be rendered in the markup as the `textContent`
158
158
159
159
### Marking an input as invalid
160
160
@@ -164,20 +164,20 @@ We use `aria-invalid="true"` to indicate that an input is invalid. This makes yo
164
164
165
165
To link an `input` or `form` to an error container, you:
166
166
167
-
- Add the error container's markup to the page, with a unique `id` and the `data-error-container` attribute
167
+
- Add the error container's markup to the page, with a unique `id` and the `data-pf-error-container` attribute
168
168
- Include that `id` in the `input`/`form`'s `aria-describedby`
169
169
170
-
We use the `aria-describedby` so that your markup is **accessible by default**. Since there can be [multiple elements that describe an element](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-describedby#id_reference_list), You specify which one is the error container using `data-error-container`.
170
+
We use the `aria-describedby` so that your markup is **accessible by default**. Since there can be [multiple elements that describe an element](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-describedby#id_reference_list), You specify which one is the error container using `data-pf-error-container`.
@@ -215,14 +215,14 @@ if (!window.customElements.get('app-error-handling')) {
215
215
216
216
### Handling the initial page load
217
217
218
-
- Render any error list items that should be visible on the initial page load with the `data-visible` attribute
218
+
- Render any error list items that should be visible on the initial page load with the `data-pf-error-visible` attribute
219
219
- Mark the invalid inputs with:
220
220
-`aria-invalid=true`
221
-
-`data-initial-load-errors`
221
+
-`data-pf-initial-load-errors`
222
222
223
223
To reflect any other errors that might be present from the Constraint Validation API, you can use the `reflectConstraintValidationForInitialLoad` method in`@practical-computer/error-handling/element-utilities`.
224
224
225
-
This method will skip any `form.elements`with blank values, or the `data-initial-load-errors` attribute.
225
+
This method will skip any `form.elements`with blank values, or the `data-pf-initial-load-errors` attribute.
226
226
227
227
228
228
### Server-side errors
@@ -294,7 +294,7 @@ One of the best ways to understand this package is to glance at the source. It's
294
294
- Any preserved errors for a list (or for a specific `type` of error)
295
295
- Rendering helper functions, including:
296
296
- Reflecting the current [`ValidityState`](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) of an element
297
-
- Applyig the `data-` and ARIA attributes to mark an element as invalid, without going through the Constraint Validation API
297
+
- Applyig the `data-pf` and ARIA attributes to mark an element as invalid, without going through the Constraint Validation API
298
298
- Marking an error `type` as visible for an element
299
299
- Creating a new error list item element
300
300
- Clearing the error list for an element, or for an entire form.
@@ -323,7 +323,7 @@ Validation is almost always application/framework dependent; and best served by
323
323
324
324
#### Markup for rendering errors
325
325
326
-
You provide the markup, using ARIA attributes, a small set of `data-` attributes, and a `template` element. Fitting error messages into a design is *tough* and extremely context specific. We trust your judgement, and render the text and set the `data-visible` attributes in the places you put us to.
326
+
You provide the markup, using ARIA attributes, a small set of `data-` attributes (prefixed with `data-pf`), and a `template` element. Fitting error messages into a design is *tough* and extremely context specific. We trust your judgement, and render the text and set the `data-pf-error-visible` attributes in the places you put us to.
<lidata-visibledata-error-type="error_1">ad-hoc error message 1 <small>(rendered on initial load)</small></li>
96
-
<lidata-preservedata-error-type="tooShort">Custom Preserved Error: Must be at least 4 characters<small>(rendered on initial load)</small></li>
95
+
<lidata-pf-error-visibledata-pf-error-type="error_1">ad-hoc error message 1 <small>(rendered on initial load)</small></li>
96
+
<lidata-pf-error-preservedata-pf-error-type="tooShort">Custom Preserved Error: Must be at least 4 characters<small>(rendered on initial load)</small></li>
0 commit comments