Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion resources/js/Pages/error-handling.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Code, H1, H2, P, TabbedCode } from '@/Components'
import { A, Code, CodeBlock, H1, H2, P, TabbedCode } from '@/Components'
import dedent from 'dedent-js'

export const meta = {
title: 'Error handling',
links: [
{ url: '#development', name: 'Development' },
{ url: '#dialog-element', name: 'Dialog element' },
{ url: '#production', name: 'Production' },
],
}
Expand Down Expand Up @@ -34,6 +35,29 @@ export default function () {
src="https://player.vimeo.com/video/363562630?autoplay=1&loop=1&muted=1&background=1"
></iframe>
</div>
<H2>Dialog element</H2>
<P>
By default, Inertia displays error modals using a custom <Code>{'<div>'}</Code> overlay. However, you can opt-in
to using the native HTML <Code>{'<dialog>'}</Code> element instead, which provides built-in modal functionality
including backdrop handling.
</P>
<P>
To enable this, configure the <Code>future.useDialogForErrorModal</Code> option in your{' '}
<A href="/client-side-setup#configuring-defaults">application defaults</A>.
</P>
<CodeBlock
language="js"
children={dedent`
createInertiaApp({
// resolve, setup, etc.
defaults: {
future: {
useDialogForErrorModal: true,
},
},
})
`}
/>
<H2>Production</H2>
<P>
In production you will want to return a proper Inertia error response instead of relying on the modal-driven
Expand Down
27 changes: 26 additions & 1 deletion resources/js/Pages/title-and-meta.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Code, CodeBlock, H1, H2, Notice, P, TabbedCode } from '@/Components'
import { A, Code, CodeBlock, H1, H2, Notice, P, TabbedCode } from '@/Components'
import dedent from 'dedent-js'

export const meta = {
Expand All @@ -9,6 +9,7 @@ export const meta = {
{ url: '#title-callback', name: 'Title callback' },
{ url: '#multiple-head-instances', name: 'Multiple Head instances' },
{ url: '#head-extension', name: 'Head extension' },
{ url: '#inertia-attribute-on-elements', name: 'Inertia attribute' },
],
}

Expand Down Expand Up @@ -371,6 +372,30 @@ export default function () {
},
]}
/>
<H2>Inertia attribute on elements</H2>
<P>
Inertia has historically used the <Code>inertia</Code> attribute to track and manage elements in the document{' '}
<Code>{'<head>'}</Code>. However, you can now opt-in to using the more standards-compliant{' '}
<Code>data-inertia</Code> attribute instead. According to the HTML specification, custom attributes should be
prefixed with <Code>data-</Code> to avoid conflicts with future HTML standards.
</P>
<P>
To enable this, configure the <Code>future.useDataInertiaHeadAttribute</Code> option in your{' '}
<A href="/client-side-setup#configuring-defaults">application defaults</A>.
</P>
<CodeBlock
language="js"
children={dedent`
createInertiaApp({
// resolve, setup, etc.
defaults: {
future: {
useDataInertiaHeadAttribute: true,
},
},
})
`}
/>
</>
)
}