Skip to content

Commit cd7e77a

Browse files
authored
Document future app settings (#483)
1 parent 13a5b50 commit cd7e77a

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

resources/js/Pages/error-handling.jsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Code, H1, H2, P, TabbedCode } from '@/Components'
1+
import { A, Code, CodeBlock, H1, H2, P, TabbedCode } from '@/Components'
22
import dedent from 'dedent-js'
33

44
export const meta = {
55
title: 'Error handling',
66
links: [
77
{ url: '#development', name: 'Development' },
8+
{ url: '#dialog-element', name: 'Dialog element' },
89
{ url: '#production', name: 'Production' },
910
],
1011
}
@@ -34,6 +35,29 @@ export default function () {
3435
src="https://player.vimeo.com/video/363562630?autoplay=1&loop=1&muted=1&background=1"
3536
></iframe>
3637
</div>
38+
<H2>Dialog element</H2>
39+
<P>
40+
By default, Inertia displays error modals using a custom <Code>{'<div>'}</Code> overlay. However, you can opt-in
41+
to using the native HTML <Code>{'<dialog>'}</Code> element instead, which provides built-in modal functionality
42+
including backdrop handling.
43+
</P>
44+
<P>
45+
To enable this, configure the <Code>future.useDialogForErrorModal</Code> option in your{' '}
46+
<A href="/client-side-setup#configuring-defaults">application defaults</A>.
47+
</P>
48+
<CodeBlock
49+
language="js"
50+
children={dedent`
51+
createInertiaApp({
52+
// resolve, setup, etc.
53+
defaults: {
54+
future: {
55+
useDialogForErrorModal: true,
56+
},
57+
},
58+
})
59+
`}
60+
/>
3761
<H2>Production</H2>
3862
<P>
3963
In production you will want to return a proper Inertia error response instead of relying on the modal-driven

resources/js/Pages/title-and-meta.jsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Code, CodeBlock, H1, H2, Notice, P, TabbedCode } from '@/Components'
1+
import { A, Code, CodeBlock, H1, H2, Notice, P, TabbedCode } from '@/Components'
22
import dedent from 'dedent-js'
33

44
export const meta = {
@@ -9,6 +9,7 @@ export const meta = {
99
{ url: '#title-callback', name: 'Title callback' },
1010
{ url: '#multiple-head-instances', name: 'Multiple Head instances' },
1111
{ url: '#head-extension', name: 'Head extension' },
12+
{ url: '#inertia-attribute-on-elements', name: 'Inertia attribute' },
1213
],
1314
}
1415

@@ -371,6 +372,30 @@ export default function () {
371372
},
372373
]}
373374
/>
375+
<H2>Inertia attribute on elements</H2>
376+
<P>
377+
Inertia has historically used the <Code>inertia</Code> attribute to track and manage elements in the document{' '}
378+
<Code>{'<head>'}</Code>. However, you can now opt-in to using the more standards-compliant{' '}
379+
<Code>data-inertia</Code> attribute instead. According to the HTML specification, custom attributes should be
380+
prefixed with <Code>data-</Code> to avoid conflicts with future HTML standards.
381+
</P>
382+
<P>
383+
To enable this, configure the <Code>future.useDataInertiaHeadAttribute</Code> option in your{' '}
384+
<A href="/client-side-setup#configuring-defaults">application defaults</A>.
385+
</P>
386+
<CodeBlock
387+
language="js"
388+
children={dedent`
389+
createInertiaApp({
390+
// resolve, setup, etc.
391+
defaults: {
392+
future: {
393+
useDataInertiaHeadAttribute: true,
394+
},
395+
},
396+
})
397+
`}
398+
/>
374399
</>
375400
)
376401
}

0 commit comments

Comments
 (0)