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
test('it should render with an `alertdialog` role and auto-generated `aria-labelledby` when title and actions are provided',asyncfunction(assert){
192
+
// aria-labelledby
193
+
194
+
test('it should render with an auto-generated `aria-labelledby` when a title is provided',asyncfunction(assert){
154
195
awaitrender(
155
-
hbs`<Hds::Alert @type="inline" id="test-alert" as |A|><A.Title>This is the title</A.Title><A.Button @text="I am a button" @size="small" /></Hds::Alert>`
196
+
hbs`
197
+
<Hds::Alert @type="inline" id="test-alert" as |A|>
test('it should render with an `alertdialog` role and auto-generated `aria-labelledby` when description and actions are provided',asyncfunction(assert){
206
+
test('it should render with an auto-generated `aria-labelledby` when description is provided',asyncfunction(assert){
163
207
awaitrender(
164
-
hbs`<Hds::Alert @type="inline" id="test-alert" as |A|><A.Description>This is the title</A.Description><A.Button @text="I am a button" @size="small" /></Hds::Alert>`
208
+
hbs`
209
+
<Hds::Alert @type="inline" id="test-alert" as |A|>
test('it should render with with role="alertdialog" and aria-live="polite" for the "warning" color when actions are provided',asyncfunction(assert){
174
237
awaitrender(
175
-
hbs`<Hds::Alert @type="inline" id="test-alert" as |A|><A.Title id="custom-id">This is the title</A.Title><A.Button @text="I am a button" @size="small" /></Hds::Alert>`
238
+
hbs`
239
+
<Hds::Alert @type="inline" @color="warning" id="test-alert" as |A|>
// * Colors for informational & promo usages: neutral, highlight
261
+
262
+
test('it should not render with with role="alertdialog" and aria-live="polite" for the "neutral" color when actions are provided',asyncfunction(assert){
263
+
awaitrender(
264
+
hbs`
265
+
<Hds::Alert @type="inline" @color="neutral" id="test-alert" as |A|>
test('it should not render with with role="alertdialog" and aria-live="polite" for the "highlight" color when actions are provided',asyncfunction(assert){
275
+
awaitrender(
276
+
hbs`
277
+
<Hds::Alert @type="inline" @color="highlight" id="test-alert" as |A|>
Sets the color scheme for `background`, `border`, `title`, and `description`, which **cannot** be overridden.<br/><br/>`color` results in a default `icon`, which **can** be overridden.
25
+
Sets the color scheme for `background`, `border`, `title`, and `description`, which **cannot** be overridden.<br/><br/>`color` results in a default `icon`, which **can** be overridden.<br/><br/>For the “success”, “warning”, and “critical” colors, either `role="alert"` or `role="alertdialog"` and `aria-live="polite"` will be included by default which can be overridden if necessary.<br/><br/>The “neutral” and “highlight” colors do not include a role attribute or `aria-live="polite"` by default.
26
26
</C.Property>
27
27
<C.Property @name="icon" @type="string | false">
28
28
Override the default `icon` name, which is determined by the `color` argument.<br/><br/>accepts any [icon](/icons/library) name, or `false`, for no icon.
Copy file name to clipboardexpand all lines: website/docs/components/alert/partials/code/how-to-use.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -68,8 +68,14 @@ The default `@tag` is `"div"` because the correct value is dependent on the indi
68
68
69
69
### Color
70
70
71
-
A different color can be applied to the Alert using the `color` argument. This will determine the default icon used in the Alert, unless overwritten.
71
+
The available color values are `neutral` (the default), `highlight`, `success`, `warning`, and `critical`. Setting a color value will also determine the default icon used in the Alert, although it is customizable.
72
72
73
+
The color value will also determine some accessibility features of the component, so this should be taken into consideration when choosing which Alert `color` value to use.
74
+
75
+
76
+
If the alert is being used in an informational or promotional way, `neutral` or `highlight` colors should be chosen.
77
+
78
+
The other color values map to accessibility-related roles, and will ensure that essential information is presented to the user with assistive technology in a timely manner.
73
79
```handlebars
74
80
<Hds::Alert @type="inline" @color="success" as |A|>
0 commit comments