Skip to content

Commit 7fcb410

Browse files
authored
do not apply aria-modal in demo mode (#3227)
When you have a `role="dialog"` and an `aria-modal="true"` at the same time, then Safari will focus the first focusable element inside the dialog. This is not ideal, because in demo mode this means that the focus is moved around to various DOM elements. This commit ensures that the `aria-modal` is not applied when demo mode is enabled to prevent that behavior in Safari.
1 parent 045f2bc commit 7fcb410

File tree

1 file changed

+1
-1
lines changed
  • packages/@headlessui-react/src/components/dialog

1 file changed

+1
-1
lines changed

packages/@headlessui-react/src/components/dialog/dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ function DialogFn<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG>(
357357
id,
358358
role,
359359
tabIndex: -1,
360-
'aria-modal': dialogState === DialogStates.Open ? true : undefined,
360+
'aria-modal': __demoMode ? undefined : dialogState === DialogStates.Open ? true : undefined,
361361
'aria-labelledby': state.titleId,
362362
'aria-describedby': describedby,
363363
}

0 commit comments

Comments
 (0)