Skip to content

Commit 2cf4569

Browse files
authored
Fix warning about inert attribute in React < 19 (#2536)
1 parent af6ca2c commit 2cf4569

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react/src/Form.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ const Form = forwardRef<FormComponentRef, ComponentProps>(
190190
event.preventDefault()
191191
submit()
192192
},
193-
inert: disableWhileProcessing && form.processing,
193+
// Only React 19 supports passing a boolean to the `inert` attribute.
194+
// To support earlier versions as well, we use the string 'true'.
195+
// Unfortunately, React 19 treats an empty string as `false`.
196+
// See: https://github.com/inertiajs/inertia/pull/2536
197+
inert: disableWhileProcessing && form.processing && 'true',
194198
},
195199
typeof children === 'function' ? children(exposed()) : children,
196200
)

0 commit comments

Comments
 (0)