You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/action-sheet.md
+146-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
1
---
2
2
title: "ion-action-sheet"
3
3
---
4
+
import Tabs from '@theme/Tabs';
5
+
import TabItem from '@theme/TabItem';
6
+
4
7
import Props from '@ionic-internal/component-api/v7/action-sheet/props.md';
5
8
import Events from '@ionic-internal/component-api/v7/action-sheet/events.md';
6
9
import Methods from '@ionic-internal/component-api/v7/action-sheet/methods.md';
@@ -94,10 +97,150 @@ import CssCustomProperties from '@site/static/usage/v7/action-sheet/theming/css-
94
97
95
98
## Accessibility
96
99
100
+
### Screen Readers
101
+
102
+
Action Sheets set aria properties in order to be [accessible](../reference/glossary#a11y) to screen readers, but these properties can be overridden if they aren't descriptive enough or don't align with how the action sheet is being used in an app.
103
+
104
+
#### Role
105
+
97
106
Action Sheets are given a `role` of [`dialog`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role). In order to align with the ARIA spec, either the `aria-label` or `aria-labelledby` attribute must be set.
98
107
108
+
#### Action Sheet Description
109
+
99
110
It is strongly recommended that every Action Sheet have the `header` property defined, as Ionic will automatically set `aria-labelledby` to point to the header element. However, if you choose not to include a `header`, an alternative is to use the `htmlAttributes` property to provide a descriptive `aria-label` or set a custom `aria-labelledby` value.
Buttons containing text will be read by a screen reader. If a button contains only an icon, or a description other than the existing text is desired, a label should be assigned to the button by passing `aria-label` to the `htmlAttributes` property on the button.
Copy file name to clipboardExpand all lines: docs/api/alert.md
+150-2
Original file line number
Diff line number
Diff line change
@@ -111,25 +111,173 @@ import Customization from '@site/static/usage/v7/alert/customization/index.md';
111
111
112
112
## Accessibility
113
113
114
+
### Screen Readers
115
+
116
+
Alerts set aria properties in order to be [accessible](../reference/glossary#a11y) to screen readers, but these properties can be overridden if they aren't descriptive enough or don't align with how the alert is being used in an app.
117
+
118
+
#### Role
119
+
114
120
Ionic automatically sets the Alert's `role` to either [`alertdialog`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role) if there are any inputs or buttons included, or [`alert`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role) if there are none.
115
121
122
+
#### Alert Description
123
+
116
124
If the `header` property is defined for the Alert, the `aria-labelledby` attribute will be automatically set to the header's ID. The `subHeader` element will be used as a fallback if `header` is not defined. Similarly, the `aria-describedby` attribute will be automatically set to the ID of the `message` element if that property is defined.
117
125
118
126
It is strongly recommended that your Alert have a `message`, as well as either a `header` or `subHeader`, in order to align with the ARIA spec. If you choose not to include a `header` or `subHeader`, an alternative is to provide a descriptive `aria-label` using the `htmlAttributes` property.
message:'This is an alert with custom aria attributes.',
135
+
htmlAttributes: {
136
+
'aria-label':'alert dialog',
137
+
},
138
+
});
139
+
```
140
+
141
+
</TabItem>
142
+
143
+
<TabItemvalue="javascript">
144
+
145
+
```javascript
146
+
constalert=awaitthis.alertController.create({
147
+
message:'This is an alert with custom aria attributes.',
148
+
htmlAttributes: {
149
+
'aria-label':'alert dialog',
150
+
},
151
+
});
152
+
```
153
+
154
+
</TabItem>
155
+
156
+
<TabItemvalue="react">
157
+
158
+
```javascript
159
+
useIonAlert({
160
+
message:'This is an alert with custom aria attributes.',
161
+
htmlAttributes: {
162
+
'aria-label':'alert dialog',
163
+
},
164
+
});
165
+
```
166
+
167
+
</TabItem>
168
+
169
+
<TabItemvalue="vue">
170
+
171
+
```javascript
172
+
constalert=awaitalertController.create({
173
+
message:'This is an alert with custom aria attributes.',
174
+
htmlAttributes: {
175
+
'aria-label':'alert dialog',
176
+
},
177
+
});
178
+
```
179
+
180
+
</TabItem>
181
+
182
+
</Tabs>
183
+
184
+
120
185
All ARIA attributes can be manually overwritten by defining custom values in the `htmlAttributes` property of the Alert.
121
186
187
+
#### Alert Buttons Description
188
+
189
+
Buttons containing text will be read by a screen reader. If a description other than the existing text is desired, a label can be set on the button by passing `aria-label` to the `htmlAttributes` property on the button.
0 commit comments