@brightspace-ui/core 2.86.4 → 2.86.5

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
  };
@@ -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.5",
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",