@brightspace-ui/core 3.58.0 → 3.60.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -34,33 +34,31 @@ Alerts communicate critical information relating to the state of the system and
|
|
34
34
|
|
35
35
|
<d2l-button id="open" style="align-self:center;display:none;">Show Alerts</d2l-button>
|
36
36
|
<d2l-alert id="alert" type="default" button-text="Undo" has-close-button>
|
37
|
-
|
37
|
+
Inline Alerts can be placed anywhere in the page content
|
38
38
|
</d2l-alert>
|
39
39
|
<d2l-alert-toast id="alert-toast" type="success" open no-auto-close>
|
40
|
-
|
40
|
+
Toast Alerts appear at the botttom of the viewport
|
41
41
|
</d2l-alert-toast>
|
42
42
|
```
|
43
43
|
|
44
44
|
## Inline Alert [d2l-alert]
|
45
45
|
|
46
|
-
|
46
|
+
Use an inline alert if there is important information a user needs to know while performing a task; the alert remains visible until the user takes action or dismisses it.
|
47
47
|
|
48
48
|
### Best Practices
|
49
49
|
|
50
50
|
<!-- docs: start best practices -->
|
51
51
|
<!-- docs: start dos -->
|
52
|
-
*
|
53
|
-
*
|
54
|
-
*
|
55
|
-
* Do provide a control to dismiss the alert and prevent the message from displaying again, if applicable
|
56
|
-
* Do use sentence case for alert text, but avoid unnecessary punctuation by not placing periods at the end of single sentences
|
52
|
+
* Use an alert to highlight information that requires the user’s action or attention
|
53
|
+
* Provide a clear call to action if it can help resolve the alert
|
54
|
+
* Use sentence case for alert text and avoid unnecessary punctuation by not placing periods at the end of single sentences
|
57
55
|
<!-- docs: end dos -->
|
58
56
|
|
59
57
|
<!-- docs: start donts -->
|
60
|
-
* Don
|
61
|
-
*
|
62
|
-
* Don't
|
63
|
-
* Don
|
58
|
+
* Don't display more than one paragraph of text
|
59
|
+
* Avoid overusing them — the more commonly alerts appear, the less effective they will be
|
60
|
+
* Don't use them for promotional material or information that is not relevant to the user’s workflow
|
61
|
+
* Don’t use them for validation errors – instead, use the [Form](../../components/form) component for a consistent user experience
|
64
62
|
<!-- docs: end donts -->
|
65
63
|
<!-- docs: end best practices -->
|
66
64
|
|
@@ -71,7 +69,7 @@ The `d2l-alert` component can be used to communicate important information relat
|
|
71
69
|
</script>
|
72
70
|
|
73
71
|
<d2l-alert type="default" button-text="Undo">
|
74
|
-
|
72
|
+
An inline alert message
|
75
73
|
</d2l-alert>
|
76
74
|
```
|
77
75
|
<!-- docs: start hidden content -->
|
@@ -92,20 +90,20 @@ The `d2l-alert` component can be used to communicate important information relat
|
|
92
90
|
|
93
91
|
## Toast Alert [d2l-alert-toast]
|
94
92
|
|
95
|
-
|
96
|
-
|
93
|
+
Use a toast alert to provide feedback about an operation the user has just initiated when the result of that operation may not be apparent or obvious to the user. Toast alerts appear at the bottom of the viewport and disappear after 4 seconds by default.
|
94
|
+
|
97
95
|
### Best Practices
|
98
96
|
<!-- docs: start best practices -->
|
99
97
|
<!-- docs: start dos -->
|
100
|
-
*
|
101
|
-
*
|
102
|
-
*
|
98
|
+
* Use to convey results of a user's action when the result is not otherwise obvious
|
99
|
+
* Keep text brief — toasts should rarely spill onto more than one line at any screen size
|
100
|
+
* Use specific language — “Assignment saved” is more informative than “Successfully saved”
|
103
101
|
<!-- docs: end dos -->
|
104
102
|
<!-- docs: start donts -->
|
105
|
-
*
|
106
|
-
* Don't allow the close button to be blocked by other elements
|
107
|
-
* Don’t use
|
108
|
-
*
|
103
|
+
* If possible, avoid displaying multiple toasts — see [Multiple Toast Alerts](#multiple-toast-alerts)
|
104
|
+
* Don't allow the close button to be blocked by other elements; users shouldn't have to wait for the toast alert to go away on its own
|
105
|
+
* Don’t use for instructions or critical information since toast alerts disappear and can be easily missed or ignored — use an [Inline Alert](#d2l-alert) instead
|
106
|
+
* Avoid having two lines with `subtext` — toasts should be very brief
|
109
107
|
<!-- docs: end donts -->
|
110
108
|
<!-- docs: end best practices -->
|
111
109
|
|
@@ -133,7 +131,7 @@ a pop-up at the bottom of the screen that automatically dismisses itself by defa
|
|
133
131
|
<d2l-button id="open" style="align-self:center;display:none;">Show Alert</d2l-button>
|
134
132
|
<!-- docs: end hidden content -->
|
135
133
|
<d2l-alert-toast type="default" no-auto-close open>
|
136
|
-
A default toast alert
|
134
|
+
A default toast alert
|
137
135
|
</d2l-alert-toast>
|
138
136
|
```
|
139
137
|
|
@@ -155,7 +153,7 @@ a pop-up at the bottom of the screen that automatically dismisses itself by defa
|
|
155
153
|
|
156
154
|
### Multiple Toast Alerts
|
157
155
|
|
158
|
-
|
156
|
+
Avoid displaying more than one toast message at a time unless absolutely necessary, since they disappear after 4 seconds and can be difficult to read for some users. It's often better to use an [inline alert](#d2l-alert) so that users have time to discover and read the message.
|
159
157
|
|
160
158
|
For cases where multiple toast alerts are unavoidable, new toast messages will appear at the bottom and push older messages upward.
|
161
159
|
|
@@ -189,3 +187,9 @@ For cases where multiple toast alerts are unavoidable, new toast messages will a
|
|
189
187
|
Third toast alert
|
190
188
|
</d2l-alert-toast>
|
191
189
|
```
|
190
|
+
|
191
|
+
## Accessibility
|
192
|
+
|
193
|
+
[Inline Alerts](#d2l-alert) are meant to draw attention without interrupting the user's flow, so they do not use the ARIA `alert` role. This means screen reader users do not hear them until encountering them in the content (as intended).
|
194
|
+
|
195
|
+
[Toast Alerts](#d2l-alert-toast) leverage the ARIA `alert` role in alignment with the [W3C Alert Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alert/), so an assertive live region is created which causes the content of the alert to be announced immediately. This can interrupt the user, so it should be used sparingly as per our [Best Practices](#best-practices-1).
|
@@ -134,9 +134,11 @@ For long tables, the header row can be made to "stick" in place as the user scro
|
|
134
134
|
|
135
135
|
When tabular data can be sorted, the `<d2l-table-col-sort-button>` can be used to provide an interactive sort button as well as arrows to indicate the ascending/descending sort direction. This is meant to be used within a `d2l-table-wrapper`.
|
136
136
|
|
137
|
-
|
137
|
+
For the example below:
|
138
|
+
- The implementation is hidden. See the code in [Multi-Faceted Sort Button](#multi-faceted-sort-button) for a more detailed implementation example.
|
139
|
+
- The code itself is handling the `desc` attribute so updating it in the Properties table will not have an impact on the live demo.
|
138
140
|
|
139
|
-
<!-- docs: demo -->
|
141
|
+
<!-- docs: demo properties name:d2l-table-col-sort-button sandboxTitle:'Table Sortable Column Buttons' -->
|
140
142
|
```html
|
141
143
|
<script type="module">
|
142
144
|
import '@brightspace-ui/core/components/table/table-col-sort-button.js';
|
@@ -182,10 +184,7 @@ Note that the example below hides much of the implementation. See the code in [M
|
|
182
184
|
<thead>
|
183
185
|
<tr>
|
184
186
|
<th>
|
185
|
-
<d2l-table-col-sort-button
|
186
|
-
@click="${this._handleSort}"
|
187
|
-
?desc="${this._sortDesc}"
|
188
|
-
source-type="words">
|
187
|
+
<d2l-table-col-sort-button @click="${this._handleSort}" ?desc="${this._sortDesc}" source-type="words">
|
189
188
|
Column A
|
190
189
|
</d2l-table-col-sort-button>
|
191
190
|
</th>
|
@@ -211,6 +210,8 @@ Note that the example below hides much of the implementation. See the code in [M
|
|
211
210
|
<d2l-my-sortable-table-elem></d2l-my-sortable-table-elem>
|
212
211
|
```
|
213
212
|
|
213
|
+
The simplified property usage looks like this:
|
214
|
+
|
214
215
|
```html
|
215
216
|
<d2l-table-wrapper>
|
216
217
|
<table class="d2l-table">
|
@@ -225,6 +226,7 @@ Note that the example below hides much of the implementation. See the code in [M
|
|
225
226
|
</d2l-table-wrapper>
|
226
227
|
```
|
227
228
|
|
229
|
+
<!-- docs: start hidden content -->
|
228
230
|
### Properties
|
229
231
|
|
230
232
|
| Property | Type | Description | Default Value |
|
@@ -239,6 +241,7 @@ Note that the example below hides much of the implementation. See the code in [M
|
|
239
241
|
|---|---|
|
240
242
|
| `Default` | Column header text |
|
241
243
|
| `items` | Multi-facted sort items. Generally assigned to the `slot` attribute on a nested `d2l-table-col-sort-button-item`. |
|
244
|
+
<!-- docs: end hidden content -->
|
242
245
|
|
243
246
|
### Slotted Item [d2l-table-col-sort-button-item]
|
244
247
|
|
@@ -270,7 +273,7 @@ When a single column is responsible for sorting in multiple facets (e.g., first
|
|
270
273
|
|
271
274
|
**WARNING**: Do NOT use this if the table is using `sticky-headers` AND multiple header rows. It is not currently supported. In that siuation, continue to put multiple `d2l-table-col-sort-button` components in the same column.
|
272
275
|
|
273
|
-
<!-- docs: demo code display:block -->
|
276
|
+
<!-- docs: demo code display:block sandboxName:table-multi-faceted-sort-button sandboxTitle:'Table Multi-Faceted Sort Button' -->
|
274
277
|
```html
|
275
278
|
<script type="module">
|
276
279
|
import '@brightspace-ui/core/components/table/table-col-sort-button.js';
|
@@ -522,3 +525,12 @@ The `d2l-table-controls` component can be placed in the `d2l-table-wrapper`'s `c
|
|
522
525
|
| `no-sticky` | Boolean | Disables sticky positioning for the controls |
|
523
526
|
| `select-all-pages-allowed` | Boolean | Whether all pages can be selected |
|
524
527
|
<!-- docs: end hidden content -->
|
528
|
+
|
529
|
+
## Accessibility
|
530
|
+
|
531
|
+
The `d2l-table-wrapper` simply wraps an HTML table in order to add styles and functionality to that table. As such, it is important to use proper table markup. Recommendations are available in [this tutorial](https://www.w3.org/WAI/tutorials/tables/). Make sure to include column and row headings so data is meaningful to screen reader users.
|
532
|
+
|
533
|
+
The `d2l-table-col-sort-button` component was built with screen reader users at front-of-mind. Important features include:
|
534
|
+
- A `source-type` attribute which lets users specify the type of data in the column (e.g., 'words', 'dates', or 'numbers') in order to provide a more descriptive title to both screen reader and sighted users
|
535
|
+
- Changes to sort order and/or sort state are reflected in attributes such that they can be communicated to screen reader users if supported by the screen reader, which they are in most scenarios
|
536
|
+
- Usage of our accessible menu component for the multi-faceted sort case
|
@@ -13,7 +13,9 @@ import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
13
13
|
|
14
14
|
/**
|
15
15
|
* Button for sorting a table column in ascending/descending order.
|
16
|
+
* @fires click - Dispatched when the button is clicked
|
16
17
|
* @slot - Text of the sort button
|
18
|
+
* @slot items - Multi-facted sort items. Generally assigned to the slot attribute on a nested d2l-table-col-sort-button-item.
|
17
19
|
*/
|
18
20
|
export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElement)) {
|
19
21
|
|
@@ -44,7 +46,7 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
|
|
44
46
|
type: String
|
45
47
|
},
|
46
48
|
/**
|
47
|
-
* The type of data in the column. Used to set the title.
|
49
|
+
* ACCESSIBILITY: The type of data in the column (e.g., 'words'). Used to set the title.
|
48
50
|
* @type {'words'|'numbers'|'dates'|'unknown'}
|
49
51
|
*/
|
50
52
|
sourceType: {
|
package/custom-elements.json
CHANGED
@@ -12272,7 +12272,7 @@
|
|
12272
12272
|
},
|
12273
12273
|
{
|
12274
12274
|
"name": "source-type",
|
12275
|
-
"description": "The type of data in the column. Used to set the title.",
|
12275
|
+
"description": "ACCESSIBILITY: The type of data in the column (e.g., 'words'). Used to set the title.",
|
12276
12276
|
"type": "'words'|'numbers'|'dates'|'unknown'",
|
12277
12277
|
"default": "\"unknown\""
|
12278
12278
|
}
|
@@ -12302,15 +12302,25 @@
|
|
12302
12302
|
{
|
12303
12303
|
"name": "sourceType",
|
12304
12304
|
"attribute": "source-type",
|
12305
|
-
"description": "The type of data in the column. Used to set the title.",
|
12305
|
+
"description": "ACCESSIBILITY: The type of data in the column (e.g., 'words'). Used to set the title.",
|
12306
12306
|
"type": "'words'|'numbers'|'dates'|'unknown'",
|
12307
12307
|
"default": "\"unknown\""
|
12308
12308
|
}
|
12309
12309
|
],
|
12310
|
+
"events": [
|
12311
|
+
{
|
12312
|
+
"name": "click",
|
12313
|
+
"description": "Dispatched when the button is clicked"
|
12314
|
+
}
|
12315
|
+
],
|
12310
12316
|
"slots": [
|
12311
12317
|
{
|
12312
12318
|
"name": "",
|
12313
12319
|
"description": "Text of the sort button"
|
12320
|
+
},
|
12321
|
+
{
|
12322
|
+
"name": "items",
|
12323
|
+
"description": "Multi-facted sort items. Generally assigned to the slot attribute on a nested d2l-table-col-sort-button-item."
|
12314
12324
|
}
|
12315
12325
|
]
|
12316
12326
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.60.0",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|