@@ -155,18 +155,31 @@ By default, the Modal will be rendered at the end of the html body tag. If you w
155155
156156## Accessibility
157157
158- - Use the ` aria-labelledby ` and ` aria-describedby ` props to follow the [ ARIA best practices] ( https://www.w3.org/TR/wai-aria-practices/#dialog_modal ) .
158+ - Follow the [ ARIA best practices] ( https://www.w3.org/TR/wai-aria-practices/#dialog_modal ) by using either:
159+ - ` ariaLabelledby ` and ` ariaDescribedby ` props to reference visible content, OR
160+ - ` ariaLabel ` prop for a simple accessible label
159161
160162``` javascript
163+ // Option 1: Using ariaLabelledby and ariaDescribedby
161164< Modal
162165 open= {open}
163166 onClose= {onCloseModal}
164- aria - labelledby = " my-modal-title"
165- aria - describedby = " my-modal-description"
167+ ariaLabelledby = " my-modal-title"
168+ ariaDescribedby = " my-modal-description"
166169>
167170 < h2 id= " my-modal-title" > My Title< / h2>
168171 < p id= " my-modal-description" > My Description< / p>
169172< / Modal>
173+
174+ // Option 2: Using ariaLabel
175+ < Modal
176+ open= {open}
177+ onClose= {onCloseModal}
178+ ariaLabel= " Modal Title"
179+ >
180+ < h2> Preferences< / h2>
181+ < p> Update your settings below< / p>
182+ < / Modal>
170183```
171184
172185- ` aria-modal ` is set to true automatically.
@@ -197,7 +210,8 @@ By default, the Modal will be rendered at the end of the html body tag. If you w
197210| ** animationDuration** | ` number ` | 300 | Animation duration in milliseconds. |
198211| ** role** | ` string ` | "dialog" | ARIA role for modal |
199212| ** ref** | ` React.RefElement<HTMLDivElement> ` | undefined | Ref for modal dialog element |
200- | ** ariaLabelledby** | ` string ` | | ARIA label for modal |
213+ | ** ariaLabel** | ` string ` | | ARIA label for modal |
214+ | ** ariaLabelledby** | ` string ` | | ARIA labelledby for modal |
201215| ** ariaDescribedby** | ` string ` | | ARIA description for modal |
202216| ** containerId** | ` string ` | | id attribute for modal container |
203217| ** modalId** | ` string ` | | id attribute for modal | |
0 commit comments