---
id: Modal
section: components
---
import { Checkbox, List, ListItem } from '@patternfly/react-core';
import { Link } from '@patternfly/documentation-framework/components/link/link';
## Accessibility
To implement an accessible PatternFly **modal** component:
- Add an `aria-label` to the modal if it doesn't have a visible text title
- Provide at least one clickable button that can close the modal, such as the default close icon or a "cancel" button
- Ensure any other PatternFly components follow their respective accessibility documentation
## Testing
At a minimum, a modal should meet the following criteria:
## React customization
The following React props have been provided for more fine-tuned control over accessibility.
| Prop | Applied to | Reason |
|---|---|---|
| `aria-describedby="[id of the element that describes the modal"` | `Modal` | Adds an accessible description to the modal. Typically this will be the id of the primary modal content. |
| `aria-label="[text that labels the modal]"` | `Modal` | Adds an accessible name to the modal. **Required** if there is no visible text that acts as the modal title, such as from the `title` or `header` props. |
| `aria-labelledby="[id of the element that labels the modal]"` | `Modal` | Adds an accessible name to the modal. **Required** if using the `header` prop rather than the `title` prop. |
| `bodyAriaLabel` | `Modal` | Adds an accessible name to the modal body. **Required** when the content of the modal body overflows and triggers a scrollbar.
When passed in, the accessible `role` of the modal body will be set to `region` by default. |
| `bodyAriaRole` | `Modal` | Adds an accessible role to the modal body. Passing this prop in will override the default `region` role when `bodyAriaLabel` is passed in. |
| `disableFocusTrap` | `Modal` | Disables the built-in focus trap functionality and allowing custom focus management when the modal is opened. When passing this prop in, you must manually trap focus yourself so that content outside of the open modal cannot be interacted with or navigated to. |
| `title` | `Modal` | Adds a visible text title to the modal and automatically sets the `aria-labelledby` of the modal. It is recommended to pass this prop in when also passing in the `titleIconVariant` prop to provide more context to users. |
| `titleIconVariant` | `Modal` | Adds an icon to the modal title. When passing in a custom icon that conveys status or severity, you must also pass in the `titleLabel` prop. |
| `titleLabel` | `Modal` | Adds visually hidden text before the modal title in order to describe the status or severity of the modal. If a predefined value is passed to `titleIconVariant`, the visually hidden text is automatically set to `[variant] alert:`, but can be overridden with this prop. |
## HTML/CSS customization
The following HTML attributes and PatternFly classes can be used for more fine-tuned control over accessibility.
| Attribute or class | Applied to | Reason |
|---|---|---|
| `aria-describedby="[id of the element that describes the modal"` | `.pf-v6-c-modal-box` | Adds an accessible description to the modal. Typically this will be the id of the primary modal content. |
| `aria-label="[text that labels the modal]"` | `.pf-v6-c-modal-box` | Adds an accessible name to the modal. **Required** if there is no visible text that acts as the modal title. |
| `aria-labelledby="[id of the element that labels the modal]"` | `.pf-v6-c-modal-box` | Adds an accessible name to the modal. **Required** if `.pf-v6-c-modal-box__title` or another title element is present. |
| `aria-modal="true"` | `.pf-v6-c-modal-box` | Notifies users of assistive technologies that the contents underneath the modal are not available for interaction. This does not prevent other content from being interacted with, nor does it make the element a modal itself. **Required**. |
| `role="dialog"` | `.pf-v6-c-modal-box` | Identifies the element that serves as the modal container. **Required**. |
| `aria-label="[text labeling the modal body]"` | `.pf-v6-c-modal-box__body` | Adds an accessible name to the modal body. This attribute should only be passed in if the `role` attribute is also passed in. **Required** if the modal body content renders a scrollbar due to overflow. |
| `role="[role of the modal body]"` | `.pf-v6-c-modal-box__body` | Adds an accessible role to the modal body. Typically "region" is passed in as the role. **Required** if the modal body content renders a scrollbar due to overflow. |
| `tab-index="0"` | `.pf-v6-c-modal-box__body` | Makes the modal body focusable via keyboard and other assistive technologies. **Required** if the modal body content renders a scrollbar due to overflow. |
| `aria-label="Close"` | `.pf-v6-c-modal-box__close .pf-v6-c-button` | Adds an accessible name to the close button of a modal. **Required**. |
| `form="[id of the form element in the modal body]"` | `.pf-v6-c-modal-box__footer .pf-v6-c-button` | Links a "submit" button in the modal footer with a form in the modal body. **Required** when the submit button is outside of a `