Skip to content

Commit 0c00612

Browse files
committed
docs(ui-dialog): add a11y clarifications to Dialog docs
Closes: INSTUI-4293, INSTUI-4291
1 parent 3e109be commit 0c00612

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/ui-dialog/src/Dialog/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Elements outside of the `Dialog` are hidden from screen readers automatically wh
2828
defaultFocusElement={() => this._firstName}
2929
shouldReturnFocus
3030
onDismiss={() => this.setState({ open: false })}
31+
label="Full name form"
3132
>
3233
<View
3334
as="div"
@@ -53,10 +54,10 @@ Elements outside of the `Dialog` are hidden from screen readers automatically wh
5354
>
5455
<TextInput
5556
width="12rem"
56-
renderLabel="First"
57+
renderLabel="First name"
5758
inputRef={(c) => (this._firstName = c)}
5859
/>
59-
<TextInput width="12rem" renderLabel="Last" />
60+
<TextInput width="12rem" renderLabel="Last name" />
6061
</FormFieldGroup>
6162
</View>
6263
</Dialog>
@@ -85,6 +86,7 @@ Elements outside of the `Dialog` are hidden from screen readers automatically wh
8586
defaultFocusElement={() => this._firstName}
8687
shouldReturnFocus
8788
onDismiss={() => setOpen(false)}
89+
label="Full name form"
8890
>
8991
<View
9092
as="div"
@@ -110,10 +112,10 @@ Elements outside of the `Dialog` are hidden from screen readers automatically wh
110112
>
111113
<TextInput
112114
width="12rem"
113-
renderLabel="First"
115+
renderLabel="First name"
114116
inputRef={(c) => (this._firstName = c)}
115117
/>
116-
<TextInput width="12rem" renderLabel="Last" />
118+
<TextInput width="12rem" renderLabel="Last name" />
117119
</FormFieldGroup>
118120
</View>
119121
</Dialog>
@@ -141,6 +143,7 @@ type: embed
141143
<Figure.Item>When dialogs are triggered by buttons or links (buttons are recommended), accessibility can be further enhanced by applying aria-haspopup="dialog" to the trigger. This will notify screen reader users that the trigger opens a dialog</Figure.Item>
142144
<Figure.Item>We recommend that dialogs begin with a heading (typically an H2)</Figure.Item>
143145
<Figure.Item>Dialogs should be able to be closed by clicking away, esc key and/or a close button</Figure.Item>
146+
<Figure.Item>It is recommended to provide a label for the dialog because, when specified, it will automatically set role="dialog". Alternatively, you can set aria-labelledby on the dialog to reference the ID of the visible title and set role="dialog" manually.</Figure.Item>
144147
</Figure>
145148
</Guidelines>
146149
```

packages/ui-dialog/src/Dialog/props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type DialogOwnProps = {
4646
as?: AsElementType
4747
display?: 'auto' | 'block' | 'inline-block'
4848
/**
49-
* The aria-label to read for screen reader.
49+
* The aria-label to read for screen reader. When specified, it will automatically set role="dialog".
5050
*/
5151
label?: string
5252
/**

0 commit comments

Comments
 (0)