@brightspace-ui/core 2.86.2 → 2.86.4

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.
@@ -349,7 +349,10 @@ Collapsible panels have two optional slots, `header` and `actions` that can be u
349
349
  </div>
350
350
  <d2l-collapsible-panel-summary-item slot="summary" text="Week 2 Lab (PDF) attached"></d2l-collapsible-panel-summary-item>
351
351
  <d2l-collapsible-panel-summary-item slot="summary" text="1 comment"></d2l-collapsible-panel-summary-item>
352
- Expanded content
352
+ <p style="margin-top: 0;">Sweet roll candy dessert caramels shortbread gummies toffee oat cake cookie. Wafer gummies shortbread sweet halvah jujubes sweet. Cake chocolate chocolate bar carrot cake marzipan. Icing chupa chups jujubes macaroon toffee chocolate bar wafer croissant.</p>
353
+ <p>Toffee pastry chupa chups lollipop carrot cake chocolate cake sweet roll sweet roll. Marzipan pudding candy canes jelly lemon drops oat cake ice cream. Wafer danish pudding marzipan chupa chups jelly beans brownie.</p>
354
+ <p>Pastry apple pie biscuit sesame snaps sweet pie apple pie dessert jelly beans. Lemon drops croissant tootsie roll croissant oat cake. Macaroon toffee pie gummi bears cupcake wafer tiramisu.</p>
355
+ <p style="margin-bottom: 0;">Chocolate cake ice cream cake chocolate bar dessert. Donut tiramisu fruitcake tiramisu liquorice shortbread sugar plum macaroon caramels. Tart candy cookie ice cream dessert tootsie roll.</p>
353
356
  </d2l-collapsible-panel>
354
357
  ```
355
358
 
@@ -103,15 +103,16 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
103
103
  :host(:not([expanded])) .d2l-collapsible-panel {
104
104
  cursor: pointer;
105
105
  }
106
- :host([type=subtle]) .d2l-collapsible-panel {
106
+ :host([type="subtle"]) .d2l-collapsible-panel {
107
107
  background-color: white;
108
108
  border: none;
109
109
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.03);
110
110
  }
111
- :host([type=inline]) .d2l-collapsible-panel {
111
+ :host([type="inline"]) .d2l-collapsible-panel {
112
112
  border-left: none;
113
113
  border-radius: 0;
114
114
  border-right: none;
115
+ outline-offset: -2px;
115
116
  }
116
117
  :host([heading-style="1"]) {
117
118
  --d2l-collapsible-panel-header-spacing: 1.2rem;
@@ -124,6 +125,10 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
124
125
  cursor: pointer;
125
126
  padding: var(--d2l-collapsible-panel-header-spacing) 0;
126
127
  }
128
+ :host([type="inline"]) .d2l-collapsible-panel-header {
129
+ border-radius: 0;
130
+ outline-offset: -2px;
131
+ }
127
132
  .d2l-collapsible-panel.scrolled .d2l-collapsible-panel-header {
128
133
  background-color: white;
129
134
  box-shadow: 0 8px 12px -9px rgba(0, 0, 0, 0.3);
@@ -257,16 +257,28 @@ document.querySelector('#open').addEventListener('click', () => {
257
257
  });
258
258
  ```
259
259
 
260
- ## Focus Management
260
+ ## Accessibility
261
+
262
+ ### Focus Management
261
263
 
262
264
  When opened, focus will be automatically placed within the dialog. The element to be focused will either be the content element having the optional `autofocus` attribute, or a focusable element identified by the dialog depending on the type of dialog. For `d2l-dialog` and `d2l-dialog-fullscreen`, the first focusable element will be focused. For `d2l-dialog-confirm`, the least destructive action will be focused, which is assumed to be the first non-primary button in the footer.
263
265
 
264
- ### Specifying an `autofocus` Element (Optional)
266
+ #### Specifying an `autofocus` Element (Optional)
265
267
 
266
268
  To specify which element should be focused, add the `autofocus` attribute to that element. An element with the `autofocus` attribute will receive focus if the element has a `tabindex` value of `0` or `-1`, or is a naturally focusable element (e.g. button).
267
269
 
268
270
  Note that the element must be in the dialog content's DOM scope and not within another component's Shadow DOM.
269
271
 
272
+ ### Announcing the dialog text
273
+
274
+ When using `d2l-dialog` or `d2l-dialog-fullscreen` the dialog text will not be announced by screen readers. Screen readers will announce the presence of a dialog, the dialog title, and the currently focused element. For example, the general dialog example at the top of this page reads "Dialog Title dialog. clickable Done button.". The text "Some dialog content" is not announced.
275
+
276
+ To announce the dialog text, use one of the following methods:
277
+
278
+ 1. Use `d2l-dialog-confirm` instead
279
+ 2. Add `describe-content="true"` (if using `d2l-dialog`)
280
+ 3. Set `autofocus` on the first text element (see above for details)
281
+
270
282
  <!-- docs: start hidden content -->
271
283
  ## Future Improvements
272
284
 
@@ -20,38 +20,12 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
20
20
  :host(:not([button-disabled])) {
21
21
  --d2l-list-item-content-text-color: var(--d2l-color-celestine);
22
22
  }
23
- :host([button-disabled][_hovering-primary-action]) .d2l-list-item-content,
24
- :host([button-disabled][_focusing-primary-action]) .d2l-list-item-content {
25
- --d2l-list-item-content-text-color: unset;
26
- --d2l-list-item-content-text-decoration: none;
27
- }
28
- :host([button-disabled]) button {
29
- cursor: default;
23
+ :host([button-disabled]) [slot="content-action"] {
24
+ pointer-events: none;
30
25
  }
31
26
  [slot="outside-control-container"] {
32
27
  margin: 0 -12px;
33
28
  }
34
- :host(:not([selectable]):not([button-disabled]):not([skeleton])[_hovering]) [slot="control-container"]::before,
35
- :host(:not([selectable]):not([button-disabled]):not([skeleton])[_hovering]) [slot="control-container"]::after,
36
- :host(:not([selectable]):not([button-disabled]):not([skeleton])[_focusing]) [slot="control-container"]::before,
37
- :host(:not([selectable]):not([button-disabled]):not([skeleton])[_focusing]) [slot="control-container"]::after,
38
- :host([selectable]:not([selection-disabled][button-disabled]):not([skeleton])[_hovering]) [slot="control-container"]::before,
39
- :host([selectable]:not([selection-disabled][button-disabled]):not([skeleton])[_hovering]) [slot="control-container"]::after,
40
- :host([selectable]:not([selection-disabled][button-disabled]):not([skeleton])[_focusing]) [slot="control-container"]::before,
41
- :host([selectable]:not([selection-disabled][button-disabled]):not([skeleton])[_focusing]) [slot="control-container"]::after {
42
- border-top-color: transparent;
43
- }
44
- :host(:not([selectable]):not([button-disabled]):not([skeleton])[_hovering]) [slot="outside-control-container"],
45
- :host(:not([selectable]):not([button-disabled]):not([skeleton])[_focusing]) [slot="outside-control-container"],
46
- :host([selectable]:not([selection-disabled][button-disabled]):not([skeleton])[_hovering]) [slot="outside-control-container"],
47
- :host([selectable]:not([selection-disabled][button-disabled]):not([skeleton])[_focusing]) [slot="outside-control-container"] {
48
- background-color: white;
49
- border-color: #b6cbe8; /* celestine alpha 0.3 */
50
- }
51
- :host([selectable]:not([selection-disabled][button-disabled]):not([skeleton])[_hovering]) [slot="outside-control-container"],
52
- :host(:not([selectable]):not([button-disabled]):not([skeleton])[_hovering]) [slot="outside-control-container"] {
53
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
54
- }
55
29
  button {
56
30
  background-color: transparent;
57
31
  border: none;
@@ -61,11 +35,6 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
61
35
  outline: none;
62
36
  width: 100%;
63
37
  }
64
- /* simply hide the button action layer rather than disabling button so
65
- that the cursor pointer ins't displayed when hovering skeleton */
66
- :host([skeleton]) button {
67
- display: none;
68
- }
69
38
  ` ];
70
39
 
71
40
  super.styles && styles.unshift(super.styles);
@@ -78,6 +47,11 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
78
47
  this.buttonDisabled = false;
79
48
  }
80
49
 
50
+ willUpdate(changedProperties) {
51
+ super.willUpdate(changedProperties);
52
+ if (changedProperties.has('buttonDisabled') && this.buttonDisabled === true) this._hoveringPrimaryAction = false;
53
+ }
54
+
81
55
  _onButtonClick() {
82
56
  /** Dispatched when the item's primary button action is clicked */
83
57
  this.dispatchEvent(new CustomEvent('d2l-list-item-button-click', { bubbles: true }));
@@ -1,6 +1,5 @@
1
1
  import '../selection/selection-input.js';
2
2
  import { css, html, nothing } from 'lit';
3
- import { classMap } from 'lit/directives/class-map.js';
4
3
  import { getUniqueId } from '../../helpers/uniqueId.js';
5
4
  import { SelectionInfo } from '../selection/selection-mixin.js';
6
5
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
@@ -33,7 +32,8 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
33
32
  * Private. The selection info (set by the selection component).
34
33
  * @ignore
35
34
  */
36
- selectionInfo: { type: Object, attribute: false }
35
+ selectionInfo: { type: Object, attribute: false },
36
+ _hoveringSelection: { type: Boolean, attribute: '_hovering-selection', reflect: true }
37
37
  };
38
38
  }
39
39
 
@@ -44,7 +44,7 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
44
44
  display: block;
45
45
  height: 100%;
46
46
  }
47
- .d2l-checkbox-action.d2l-checkbox-action-disabled {
47
+ :host([selection-disabled]) .d2l-checkbox-action {
48
48
  cursor: default;
49
49
  }
50
50
  ` ];
@@ -95,6 +95,11 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
95
95
  if (!suppressEvent) this._dispatchSelected(selected);
96
96
  }
97
97
 
98
+ willUpdate(changedProperties) {
99
+ super.willUpdate(changedProperties);
100
+ if (changedProperties.has('selectionDisabled') && this.selectionDisabled === true) this._hoveringSelection = false;
101
+ }
102
+
98
103
  async _dispatchSelected(value) {
99
104
  /* wait for internal state to be updated in case of action-click case so that a consumer
100
105
  calling getSelectionInfo will get the correct state */
@@ -124,6 +129,14 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
124
129
  }
125
130
  }
126
131
 
132
+ _onMouseEnterSelection() {
133
+ this._hoveringSelection = !this.selectionDisabled;
134
+ }
135
+
136
+ _onMouseLeaveSelection() {
137
+ this._hoveringSelection = false;
138
+ }
139
+
127
140
  _onNestedSlotChangeCheckboxMixin() {
128
141
  this._updateNestedSelectionProvider();
129
142
  }
@@ -144,19 +157,17 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
144
157
  key="${this.key}"
145
158
  label="${this.label}"
146
159
  ?skeleton="${this.skeleton}"
147
- .hovering="${this._hovering}">
160
+ .hovering="${this._hoveringSelection}">
148
161
  </d2l-selection-input>
149
162
  ` : nothing;
150
163
  }
151
164
 
152
165
  _renderCheckboxAction(inner) {
153
- const classes = {
154
- 'd2l-checkbox-action': true,
155
- 'd2l-checkbox-action-disabled': this.selectionDisabled
156
- };
157
166
  return this.selectable ? html`
158
167
  <div @click="${this._onCheckboxActionClick}"
159
- class="${classMap(classes)}">
168
+ @mouseenter="${this._onMouseEnterSelection}"
169
+ @mouseleave="${this._onMouseLeaveSelection}"
170
+ class="d2l-checkbox-action">
160
171
  ${inner}
161
172
  </div>
162
173
  ` : nothing;
@@ -21,29 +21,12 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
21
21
  :host([action-href]:not([action-href=""])) {
22
22
  --d2l-list-item-content-text-color: var(--d2l-color-celestine);
23
23
  }
24
- :host([action-href]:not([action-href=""])[_hovering]) [slot="control-container"]::before,
25
- :host([action-href]:not([action-href=""])[_hovering]) [slot="control-container"]::after,
26
- :host([action-href]:not([action-href=""])[_focusing]) [slot="control-container"]::before,
27
- :host([action-href]:not([action-href=""])[_focusing]) [slot="control-container"]::after {
28
- border-top-color: transparent;
29
- }
30
- :host(:not([skeleton])[action-href]:not([action-href=""])[_hovering]) [slot="outside-control-container"],
31
- :host(:not([skeleton])[action-href]:not([action-href=""])[_focusing]) [slot="outside-control-container"] {
32
- background-color: white;
33
- border-color: #b6cbe8; /* celestine alpha 0.3 */
34
- }
35
- :host(:not([skeleton])[action-href]:not([action-href=""])[_hovering]) [slot="outside-control-container"] {
36
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
37
- }
38
24
  a[href] {
39
25
  display: block;
40
26
  height: 100%;
41
27
  outline: none;
42
28
  width: 100%;
43
29
  }
44
- :host([skeleton]) a {
45
- display: none;
46
- }
47
30
  ` ];
48
31
 
49
32
  super.styles && styles.unshift(super.styles);
@@ -56,6 +39,11 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
56
39
  this._primaryActionId = getUniqueId();
57
40
  }
58
41
 
42
+ willUpdate(changedProperties) {
43
+ super.willUpdate(changedProperties);
44
+ if (changedProperties.has('actionHref') && !this.actionHref) this._hoveringPrimaryAction = false;
45
+ }
46
+
59
47
  _handleLinkClick() {
60
48
  /** Dispatched when the item's primary link action is clicked */
61
49
  this.dispatchEvent(new CustomEvent('d2l-list-item-link-click', { bubbles: true }));
@@ -147,12 +147,16 @@ export const ListItemMixin = superclass => class extends composeMixins(
147
147
  :host(:last-of-type[_separators="between"]) [slot="control-container"]::after,
148
148
  :host([_separators="none"]) [slot="control-container"]::before,
149
149
  :host([_separators="none"]) [slot="control-container"]::after,
150
- :host([selectable][_hovering]:not([selection-disabled])) [slot="control-container"]::before,
151
- :host([selectable][_hovering]:not([selection-disabled])) [slot="control-container"]::after,
150
+ :host([_hovering-selection]) [slot="control-container"]::before,
151
+ :host([_hovering-selection]) [slot="control-container"]::after,
152
+ :host([_hovering-primary-action]) [slot="control-container"]::before,
153
+ :host([_hovering-primary-action]) [slot="control-container"]::after,
152
154
  :host([selectable][_focusing]) [slot="control-container"]::before,
153
155
  :host([selectable][_focusing]) [slot="control-container"]::after,
154
- :host([selected]) [slot="control-container"]::before,
155
- :host([selected]) [slot="control-container"]::after,
156
+ :host([_focusing-primary-action]) [slot="control-container"]::before,
157
+ :host([_focusing-primary-action]) [slot="control-container"]::after,
158
+ :host([selected]:not([selection-disabled]):not([skeleton])) [slot="control-container"]::before,
159
+ :host([selected]:not([selection-disabled]):not([skeleton])) [slot="control-container"]::after,
156
160
  :host(:first-of-type[_nested]) [slot="control-container"]::before {
157
161
  border-top-color: transparent;
158
162
  }
@@ -317,17 +321,21 @@ export const ListItemMixin = superclass => class extends composeMixins(
317
321
  margin: 0;
318
322
  }
319
323
 
320
- :host(:not([selection-disabled]):not([skeleton])[selected]) [slot="outside-control-container"],
321
- :host(:not([selection-disabled]):not([skeleton])[selectable][_hovering]) [slot="outside-control-container"],
324
+ :host([_hovering-primary-action]) [slot="outside-control-container"],
325
+ :host([_hovering-selection]) [slot="outside-control-container"],
326
+ :host([_focusing-primary-action]) [slot="outside-control-container"],
327
+ :host(:not([selection-disabled]):not([skeleton])[selected][_hovering-selection]) [slot="outside-control-container"],
322
328
  :host(:not([selection-disabled]):not([skeleton])[selectable][_focusing]) [slot="outside-control-container"] {
323
329
  background-color: white;
324
330
  border-color: #b6cbe8; /* celestine alpha 0.3 */
325
331
  }
326
- :host(:not([selection-disabled]):not([skeleton])[selectable][_hovering]) [slot="outside-control-container"] {
332
+ :host([_hovering-primary-action]) [slot="outside-control-container"],
333
+ :host([_hovering-selection]) [slot="outside-control-container"] {
327
334
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
328
335
  }
329
336
  :host(:not([selection-disabled]):not([skeleton])[selected]) [slot="outside-control-container"] {
330
337
  background-color: #f3fbff;
338
+ border-color: #b6cbe8; /* celestine alpha 0.3 */
331
339
  }
332
340
 
333
341
  :host(:not([selection-disabled]):not([skeleton])[padding-type="none"]) [slot="outside-control-container"] {
@@ -343,7 +351,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
343
351
  transition: border-color 400ms linear;
344
352
  }
345
353
  :host([_highlighting]) [slot="outside-control-container"],
346
- :host(:not([selection-disabled]):not([skeleton])[_hovering][_highlighting]) [slot="outside-control-container"],
354
+ :host([_hovering-selection][_highlighting]) [slot="outside-control-container"],
347
355
  :host(:not([selection-disabled]):not([skeleton])[_focusing][_highlighting]) [slot="outside-control-container"],
348
356
  :host(:not([selection-disabled]):not([skeleton])[selected][_highlighting]) [slot="outside-control-container"] {
349
357
  background-color: var(--d2l-color-celestine-plus-2);
@@ -363,6 +371,9 @@ export const ListItemMixin = superclass => class extends composeMixins(
363
371
  .d2l-list-item-tooltip-key {
364
372
  font-weight: 700;
365
373
  }
374
+ :host([skeleton]) {
375
+ pointer-events: none;
376
+ }
366
377
  `];
367
378
 
368
379
  super.styles && styles.unshift(super.styles);
@@ -632,7 +643,8 @@ export const ListItemMixin = superclass => class extends composeMixins(
632
643
  ${this._renderExpandCollapse()}
633
644
  </div>
634
645
  ${this.selectable ? html`<div slot="control">${this._renderCheckbox()}</div>` : nothing}
635
- ${this.selectable || this.expandable ? html`<div slot="control-action"
646
+ ${this.selectable || this.expandable ? html`
647
+ <div slot="control-action"
636
648
  @mouseenter="${this._onMouseEnter}"
637
649
  @mouseleave="${this._onMouseLeave}">
638
650
  ${this._renderCheckboxAction('')}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.86.2",
3
+ "version": "2.86.4",
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",