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
Copy file name to clipboardExpand all lines: .github/README.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
Improve your app's UX with just an import. A simple and performant package for accessible form input, button, and link **loading states**.
4
4
5
+
For use with [react-router](https://github.com/remix-run/react-router) 6+ or [remix](https://github.com/remix-run/react-router) 2+.
6
+
5
7
## The problem
6
8
7
9

@@ -12,14 +14,14 @@ Improve your app's UX with just an import. A simple and performant package for a
12
14
13
15
Render `BusyForm` instead of `Form` or `fetcher.Form`:
14
16
* All the form's inputs will become `readonly` during submission to prevent someone from changing input data during submission and causing themselves confusion. The `cursor` will be `wait` if hovering over an input.
15
-
* The form's submit button will become `aria-busy="true"` during submission to prevent double-clicking and causing extraneous requests. The `cursor` will be `wait` if hovering over the button, and `pointer-events` will be `none` to actually prevent clicking. A keyboard user can currently still repress the button though because I haven't found a way to prevent it.
17
+
* The form's submit button will become `aria-busy="true"` during submission to prevent double-clicking and causing extraneous requests. The `cursor` will be `wait` if hovering over the button, and `pointer-events` will be `none` to actually prevent clicking.
16
18
17
-
I chose these attributes instead of `disabled` because it causes the field to not be sent in the form data and it's not accessibility friendly.
19
+
This library doesn't make inputs `disabled` because it causes the field to not be sent in the form data and it's not accessibility friendly to dynamically toggle.
18
20
19
21
#### With navigation
20
22
21
23
```tsx
22
-
import {BusyForm} from'react-router-busy';
24
+
import {BusyForm} from'react-router-busy';
23
25
24
26
...
25
27
@@ -37,7 +39,7 @@ return (
37
39
#### With fetcher
38
40
39
41
```tsx
40
-
import {BusyForm} from'react-router-busy';
42
+
import {BusyForm} from'react-router-busy';
41
43
42
44
...
43
45
@@ -58,10 +60,10 @@ return (
58
60
59
61
### BusyLink
60
62
61
-
This library assumes all your buttons are in forms. But links are another story, so `BusyLink` is a replacement for `Link` to add this functionality for relative paths.
63
+
This library assumes all your buttons are in forms. But links are another story, so `BusyLink` is a replacement for `Link` to add this functionality for URLs to your app.
62
64
63
65
```tsx
64
-
import {BusyLink} from'react-router-busy';
66
+
import {BusyLink} from'react-router-busy';
65
67
66
68
...
67
69
@@ -76,6 +78,7 @@ return (
76
78
77
79
## To do
78
80
81
+
- Fix a keyboard user still being able re-press the button
79
82
- NavLink, Better not to have all that extra code for the `as` prop
80
83
- Also export as Form and Link in case consumers prefer not replacing name
81
84
- Make an option where you can edit the inputs after submission which cancels the current submission
0 commit comments