@brightspace-ui/core 2.86.4 → 2.86.6

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.
@@ -129,6 +129,12 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
129
129
  }
130
130
  }
131
131
 
132
+ _onCheckboxKeyDown(e) {
133
+ // handle the enter key
134
+ if (e.keyCode !== 13) return;
135
+ this.selected = !this.selected;
136
+ }
137
+
132
138
  _onMouseEnterSelection() {
133
139
  this._hoveringSelection = !this.selectionDisabled;
134
140
  }
@@ -150,24 +156,25 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
150
156
  return this.selectable ? html`
151
157
  <d2l-selection-input
152
158
  @d2l-selection-change="${this._onCheckboxChange}"
153
- ?selected="${this.selected}"
154
159
  ?disabled="${this.selectionDisabled}"
160
+ .hovering="${this._hoveringSelection}"
155
161
  id="${this._checkboxId}"
156
162
  ?_indeterminate="${this.selectionInfo.state === SelectionInfo.states.some}"
157
163
  key="${this.key}"
164
+ @keydown="${this._onCheckboxKeyDown}"
158
165
  label="${this.label}"
159
- ?skeleton="${this.skeleton}"
160
- .hovering="${this._hoveringSelection}">
166
+ ?selected="${this.selected}"
167
+ ?skeleton="${this.skeleton}">
161
168
  </d2l-selection-input>
162
169
  ` : nothing;
163
170
  }
164
171
 
165
172
  _renderCheckboxAction(inner) {
166
173
  return this.selectable ? html`
167
- <div @click="${this._onCheckboxActionClick}"
174
+ <div class="d2l-checkbox-action"
175
+ @click="${this._onCheckboxActionClick}"
168
176
  @mouseenter="${this._onMouseEnterSelection}"
169
- @mouseleave="${this._onMouseLeaveSelection}"
170
- class="d2l-checkbox-action">
177
+ @mouseleave="${this._onMouseLeaveSelection}">
171
178
  ${inner}
172
179
  </div>
173
180
  ` : nothing;
@@ -445,16 +445,10 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
445
445
 
446
446
  _onKeydown(event) {
447
447
  if (!this.gridActive) return;
448
+
448
449
  let node = null;
449
450
  let preventDefault = true;
450
451
  switch (event.keyCode) {
451
- case keyCodes.ENTER:
452
- case keyCodes.SPACE:
453
- node = getComposedActiveElement();
454
- node.click();
455
- // mouseup event is necessary for components like d2l-dropdown-more that control state by listening to this event
456
- node.dispatchEvent(new MouseEvent('mouseup', { composed: true }));
457
- break;
458
452
  case keyCodes.RIGHT:
459
453
  node = getComposedActiveElement();
460
454
  if (this.dir === 'rtl') {
@@ -49,9 +49,21 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
49
49
  this.dispatchEvent(new CustomEvent('d2l-list-item-link-click', { bubbles: true }));
50
50
  }
51
51
 
52
+ _handleLinkKeyDown(e) {
53
+ if (e.keyCode !== 32) return;
54
+ // handle the space key
55
+ e.preventDefault();
56
+ e.stopPropagation();
57
+ this.shadowRoot.querySelector(`#${this._primaryActionId}`).click();
58
+ }
59
+
52
60
  _renderPrimaryAction(labelledBy) {
53
61
  if (!this.actionHref) return;
54
- return html`<a id="${this._primaryActionId}" aria-labelledby="${labelledBy}" href="${this.actionHref}" @click="${this._handleLinkClick}"></a>`;
62
+ return html`<a aria-labelledby="${labelledBy}"
63
+ @click="${this._handleLinkClick}"
64
+ href="${this.actionHref}"
65
+ id="${this._primaryActionId}"
66
+ @keydown="${this._handleLinkKeyDown}"></a>`;
55
67
  }
56
68
 
57
69
  };
@@ -94,7 +94,7 @@ class ScrollWrapper extends FocusVisiblePolyfillMixin(RtlMixin(LitElement)) {
94
94
  .d2l-scroll-wrapper-actions {
95
95
  position: -webkit-sticky;
96
96
  position: sticky;
97
- top: 0;
97
+ top: var(--d2l-table-sticky-top, 0);
98
98
  z-index: 4;
99
99
  }
100
100
 
@@ -140,11 +140,11 @@ export const tableStyles = css`
140
140
  /* first column that's sticky: offset by size of border-radius so top/bottom border doesn't show through (default style only) */
141
141
  d2l-table-wrapper[sticky-headers][type="default"]:not([dir="rtl"]) .d2l-table > * > tr > .d2l-table-sticky-cell.d2l-table-cell-first,
142
142
  d2l-table-wrapper[sticky-headers][type="default"]:not([dir="rtl"]) .d2l-table > * > tr > [sticky].d2l-table-cell-first {
143
- left: var(--d2l-table-border-radius-sticky-offset);
143
+ left: var(--d2l-table-border-radius-sticky-offset, 0);
144
144
  }
145
145
  d2l-table-wrapper[sticky-headers][type="default"][dir="rtl"] .d2l-table > * > tr > .d2l-table-sticky-cell.d2l-table-cell-first,
146
146
  d2l-table-wrapper[sticky-headers][type="default"][dir="rtl"] .d2l-table > * > tr > [sticky].d2l-table-cell-first {
147
- right: var(--d2l-table-border-radius-sticky-offset);
147
+ right: var(--d2l-table-border-radius-sticky-offset, 0);
148
148
  }
149
149
 
150
150
  /* non-header sticky cells */
@@ -233,7 +233,7 @@ export class TableWrapper extends RtlMixin(SelectionMixin(LitElement)) {
233
233
  }
234
234
  .d2l-sticky-headers-backdrop {
235
235
  position: sticky;
236
- top: calc(var(--d2l-table-sticky-top) + var(--d2l-table-border-radius));
236
+ top: calc(var(--d2l-table-sticky-top, 0px) + var(--d2l-table-border-radius));
237
237
  width: 100%;
238
238
  z-index: 2; /* Must sit under d2l-table sticky-headers but over sticky columns and regular cells */
239
239
  }
@@ -418,15 +418,15 @@ export class TableWrapper extends RtlMixin(SelectionMixin(LitElement)) {
418
418
  }
419
419
 
420
420
  _updateStickyTops() {
421
- if (!this._table || !this.stickyHeaders) return;
422
-
423
421
  const hasStickyControls = this._controls && !this._controls.noSticky;
424
422
  let rowTop = hasStickyControls ? this._controls.offsetHeight + 6 : 0; // +6 for the internal `margin-bottom`.
425
423
  this.style.setProperty('--d2l-table-sticky-top', `${rowTop}px`);
426
424
 
425
+ if (!this._table || !this.stickyHeaders) return;
426
+
427
427
  const stickyRows = Array.from(this._table.querySelectorAll('tr.d2l-table-header, tr[header], thead tr'));
428
428
  stickyRows.forEach(r => {
429
- const thTop = hasStickyControls ? `${rowTop}px` : `calc(${rowTop}px + var(--d2l-table-border-radius-sticky-offset))`;
429
+ const thTop = hasStickyControls ? `${rowTop}px` : `calc(${rowTop}px + var(--d2l-table-border-radius-sticky-offset, 0px))`;
430
430
  const ths = Array.from(r.querySelectorAll('th'));
431
431
  ths.forEach(th => th.style.top = thTop);
432
432
 
@@ -8181,11 +8181,6 @@
8181
8181
  "default": "false"
8182
8182
  }
8183
8183
  ],
8184
- "events": [
8185
- {
8186
- "name": "mouseup"
8187
- }
8188
- ],
8189
8184
  "slots": [
8190
8185
  {
8191
8186
  "name": "outside-control",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.86.4",
3
+ "version": "2.86.6",
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",