@brightspace-ui/core 2.119.1 → 2.120.0

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.
@@ -135,6 +135,7 @@ The `d2l-list` is the container to create a styled list of items using `d2l-list
135
135
  |---|---|---|
136
136
  | `drag-multiple` | Boolean | Whether the user can drag multiple items |
137
137
  | `grid` | Boolean | Enables keyboard grid for supported list items. See [Accessibility](#accessibility). |
138
+ | `label` | String | Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists. |
138
139
  | `selection-single` | Boolean | Whether to render with single selection behaviour. If `selection-single` is specified, the list-items will render with radios instead of checkboxes, and the list component will maintain a single selected item. |
139
140
  | `separators` | String | Display separators (`all` (default), `between`, `none`) |
140
141
  | `extend-separators` | Boolean | Whether to extend the separators beyond the content's edge |
@@ -1,6 +1,7 @@
1
1
  import { css, html, LitElement } from 'lit';
2
2
  import { getNextFocusable, getPreviousFocusable } from '../../helpers/focus.js';
3
3
  import { SelectionInfo, SelectionMixin } from '../selection/selection-mixin.js';
4
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
5
  import { PageableMixin } from '../paging/pageable-mixin.js';
5
6
  import { SubscriberRegistryController } from '../../controllers/subscriber/subscriberControllers.js';
6
7
 
@@ -36,6 +37,11 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
36
37
  * @type {boolean}
37
38
  */
38
39
  grid: { type: Boolean },
40
+ /**
41
+ * Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists.
42
+ * @type {string}
43
+ */
44
+ label: { type: String },
39
45
  /**
40
46
  * Display separators. Valid values are "all" (default), "between", "none"
41
47
  * @type {'all'|'between'|'none'}
@@ -64,6 +70,7 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
64
70
  this.dragMultiple = false;
65
71
  this.extendSeparators = false;
66
72
  this.grid = false;
73
+ this.label = undefined;
67
74
  this._listItemChanges = [];
68
75
  this._childHasExpandCollapseToggle = false;
69
76
 
@@ -117,10 +124,11 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
117
124
 
118
125
  render() {
119
126
  const role = !this.grid ? 'list' : 'application';
127
+ const ariaLabel = this.slot !== 'nested' ? this.label : undefined;
120
128
  return html`
121
129
  <slot name="controls"></slot>
122
130
  <slot name="header"></slot>
123
- <div role="${role}">
131
+ <div role="${role}" aria-label="${ifDefined(ariaLabel)}">
124
132
  <slot @keydown="${this._handleKeyDown}" @slotchange="${this._handleSlotChange}"></slot>
125
133
  </div>
126
134
  ${this._renderPagerContainer()}
@@ -8899,6 +8899,12 @@
8899
8899
  "type": "boolean",
8900
8900
  "default": "false"
8901
8901
  },
8902
+ {
8903
+ "name": "label",
8904
+ "description": "Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists.",
8905
+ "type": "string",
8906
+ "default": "\"undefined\""
8907
+ },
8902
8908
  {
8903
8909
  "name": "item-count",
8904
8910
  "description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
@@ -8945,6 +8951,13 @@
8945
8951
  "type": "boolean",
8946
8952
  "default": "false"
8947
8953
  },
8954
+ {
8955
+ "name": "label",
8956
+ "attribute": "label",
8957
+ "description": "Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists.",
8958
+ "type": "string",
8959
+ "default": "\"undefined\""
8960
+ },
8948
8961
  {
8949
8962
  "name": "itemCount",
8950
8963
  "attribute": "item-count",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.119.1",
3
+ "version": "2.120.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",