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
chore: Minor Improvements/Corrections to Documentation
We missed some of these documentation updates/improvements while
updating our project. Hopefully the docs are better now, though
surely there are other improvements that could be made.
Copy file name to clipboardexpand all lines: TODO.md
+1-2
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,10 @@
2
2
3
3
## Priority
4
4
5
-
-[ ] REVIEW OUR ENTIRE `FormValidityObserver` DOCUMENTATION to make sure it's looking correct. This would include our sub-bullet point below.
6
-
-[ ] We need to update the `Integration` docs for the `FormValidityObserver`. Our example on how to create one's own integration needs to include the new change where we only use a singular `type` (instead of allowing an array of types).
7
5
-[ ] ALSO deprecate `useFormValidityObserver` in favor of `useMemo(() => createFormValidityObserver())`. We may also want to update the `DESIGN_DECISIONS` docs when we do this.
8
6
-[ ] Release `0.9.0` after doing everything ABOVE this task.
9
7
-[ ] CONSIDER updating `@form-observer/lit` to automatically use `renderByDefault` and Lit's `render` function.
8
+
-[ ] Alternatively, consider updating our StackBlitz Lit example to have a renderer example and a default-renderer example.
10
9
-[ ] Add docs on how to reconcile error messages between server and client.
11
10
-[ ] Consider doing this AFTER releasing `0.9.0` if you need to.
Copy file name to clipboardexpand all lines: docs/form-validity-observer/README.md
+18-10
Original file line number
Diff line number
Diff line change
@@ -299,20 +299,24 @@ Validates all of the observed form's fields, returning `true` if _all_ of the va
299
299
<dl>
300
300
<dt><code>focus</code></dl>
301
301
<dd>
302
-
<p>Indicates that the <em>first</em> field in the DOM that fails validation should be focused. Defaults to <code>false</code>.</p>
302
+
<p>
303
+
Indicates that the <em>first</em> field in the DOM that fails validation should be focused and scrolled into view. Defaults to <code>false</code>.
304
+
</p>
305
+
<p>
306
+
When the <code>focus</code> option is <code>false</code>, you can consider <code>validateFields()</code> to be an enhanced version of <code>form.checkValidity()</code>. When the <code>focus</code> option is <code>true</code>, you can consider <code>validateFields()</code> to be an enhanced version of <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reportValidity"><code>form.reportValidity()</code></a>.
307
+
</p>
303
308
</dd>
304
309
<dt><code>enableRevalidation</code></dt>
305
310
<dd>
306
311
<p>
307
312
Enables revalidation for <strong>all</strong> of the form's fields. Defaults to <code>true</code>. (This option is only relevant if a value was provided for the observer's <a href="#form-validity-observer-options-revalidate-on"><code>revalidateOn</code></a> option.)
308
313
</p>
314
+
<p>
315
+
Note that the <code>enableRevalidation</code> option can prevent field revalidation from being turned on, but it cannot be used to <em>turn off</em> revalidation.
316
+
</p>
309
317
</dd>
310
318
</dl>
311
319
312
-
When the `focus` option is `false`, you can consider `validateFields()` to be an enhanced version of `form.checkValidity()`. When the `focus` option is `true`, you can consider `validateFields()` to be an enhanced version of [`form.reportValidity()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reportValidity).
313
-
314
-
Note that the `enableRevalidation` option can prevent field revalidation from being turned on, but it cannot be used to _turn off_ revalidation.
Validates the form field with the specified `name`, returning `true` if the field passes validation and `false` otherwise. The `boolean` that `validateField()` returns will be wrapped in a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) if the field's [`validate` constraint](./types.md#validationerrorsm-e-r) runs asynchronously. This promise will `resolve` after the asynchronous validation function `resolves`. Unlike the [`validateFields()`](#method-formvalidityobservervalidatefieldsoptions-validatefieldsoptions-boolean--promiseboolean) method, this promise will also `reject` if the asynchronous validation function `rejects`.
@@ -330,21 +334,25 @@ Validates the form field with the specified `name`, returning `true` if the fiel
330
334
<p>An object used to configure the <code>validateField()</code> method. The following properties are supported:</p>
331
335
<dl>
332
336
<dt><code>focus</code></dt>
333
-
<dd>Indicates that the field should be focused if it fails validation. Defaults to <code>false</code>.</dd>
337
+
<dd>
338
+
<p>Indicates that the field should be focused and scrolled into view if it fails validation. Defaults to <code>false</code>.
339
+
<p>
340
+
When the <code>focus</code> option is <code>false</code>, you can consider <code>validateField()</code> to be an enhanced version of <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/checkValidity"><code>field.checkValidity()</code></a>. When the <code>focus</code> option is <code>true</code>, you can consider <code>validateField()</code> to be an enhanced version of <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/reportValidity"><code>field.reportValidity()</code></a>.
341
+
</p>
342
+
</dd>
334
343
<dt><code>enableRevalidation</code></dt>
335
344
<dd>
336
345
<p>
337
346
Enables revalidation for the validated field. Defaults to <code>true</code>. (This option is only relevant if a value was provided for the observer's <a href="#form-validity-observer-options-revalidate-on"><code>revalidateOn</code></a> option.)
338
347
</p>
348
+
<p>
349
+
Note that the <code>enableRevalidation</code> option can prevent field revalidation from being turned on, but it cannot be used to <em>turn off</em> revalidation.
350
+
</p>
339
351
</dd>
340
352
</dl>
341
353
</dd>
342
354
</dl>
343
355
344
-
When the `focus` option is `false`, you can consider `validateField()` to be an enhanced version of [`field.checkValidity()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/checkValidity). When the `focus` option is `true`, you can consider `validateField()` to be an enhanced version of [`field.reportValidity()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/reportValidity).
345
-
346
-
Note that the `enableRevalidation` option can prevent field revalidation from being turned on, but it cannot be used to _turn off_ revalidation.
Marks the form field having the specified `name` as invalid (via the [`[aria-invalid="true"]`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid) attribute) and applies the provided error `message` to it. Typically, you shouldn't need to call this method manually; but in rare situations it might be helpful.
Creates a `FormValidityObserver` whose methods can be safely destructured. It accepts the exact same arguments as the [`FormValidityObserver`'s constructor](../README.md#constructor-formvalidityobservertypes-options). If you don't need to destructure any of the observer's methods, then you are free to use the `FormValidityObserver`'s constructor directly.
Creates an enhanced version of the `FormValidityObserver`, known as the `PreactFormValidityObserver`. It accepts the exact same arguments as the [`FormValidityObserver`'s constructor](../README.md#constructor-formvalidityobservertypes-options).
Creates an enhanced version of the `FormValidityObserver`, known as the `ReactFormValidityObserver`. It accepts the exact same arguments as the [`FormValidityObserver`'s constructor](../README.md#constructor-formvalidityobservertypes-options).
Creates an enhanced version of the `FormValidityObserver`, known as the `SolidFormValidityObserver`. It accepts the exact same arguments as the [`FormValidityObserver`'s constructor](../README.md#constructor-formvalidityobservertypes-options).
Creates an enhanced version of the `FormValidityObserver`, known as the `SvelteFormValidityObserver`. It accepts the exact same arguments as the [`FormValidityObserver`'s constructor](../README.md#constructor-formvalidityobservertypes-options).
Creates an enhanced version of the `FormValidityObserver`, known as the `VueFormValidityObserver`. It accepts the exact same arguments as the [`FormValidityObserver`'s constructor](../README.md#constructor-formvalidityobservertypes-options).
0 commit comments