@brightspace-ui/core 3.59.0 → 3.60.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -262,8 +262,6 @@ To make your usage of `d2l-dropdown-more` accessible, use the following property
|
|
262
262
|
import '@brightspace-ui/core/components/dropdown/dropdown-menu.js';
|
263
263
|
import '@brightspace-ui/core/components/menu/menu.js';
|
264
264
|
import '@brightspace-ui/core/components/menu/menu-item.js';
|
265
|
-
import '@brightspace-ui/core/components/tabs/tabs.js';
|
266
|
-
import '@brightspace-ui/core/components/tabs/tab-panel.js';
|
267
265
|
</script>
|
268
266
|
<d2l-dropdown-button text="Open!" primary>
|
269
267
|
<d2l-dropdown-menu opened>
|
@@ -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: {
|
@@ -599,7 +599,7 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
599
599
|
const affectedNodes = [...removedNodes, ...addedNodes];
|
600
600
|
for (const node of affectedNodes) {
|
601
601
|
if (!(node instanceof Element)) continue;
|
602
|
-
updates.classNames ||= node.matches('tr');
|
602
|
+
updates.classNames ||= node.matches('tr, td, th');
|
603
603
|
updates.syncWidths ||= node.matches('tr');
|
604
604
|
updates.sticky ||= node.matches(SELECTORS.headers);
|
605
605
|
updates.count ||= node.matches(SELECTORS.items);
|
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.1",
|
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",
|