@brightspace-ui/core 3.179.0 → 3.181.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.
@@ -168,7 +168,7 @@ class ButtonIcon extends SlottedIconMixin(PropertyRequiredMixin(ThemeMixin(Butto
168
168
  ${this._renderIcon()}
169
169
  </button>
170
170
  ${this.description ? html`<span id="${this._describedById}" hidden>${this.description}</span>` : null}
171
- ${this.disabled && this.disabledTooltip ? html`<d2l-tooltip for="${this._buttonId}">${this.disabledTooltip}</d2l-tooltip>` : ''}
171
+ ${this.disabled && this.disabledTooltip ? html`<d2l-tooltip class="vdiff-target" for="${this._buttonId}">${this.disabledTooltip}</d2l-tooltip>` : ''}
172
172
  `;
173
173
  }
174
174
 
@@ -70,7 +70,7 @@ The list components are fairly complex and aim to be usable by all our users. In
70
70
 
71
71
  * When the `grid` attribute is used on the `d2l-list` component, it enables the list to follow the [Grid Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/grid/). More details on this are [below](#aria-layout-grid).
72
72
 
73
- * When using the `d2l-list-item-nav` component and/or mixin, usage of the `current` attribute adds the `aria-current` attribute to "page" for the `current` item and "location" for any parent and ancestors of the item. The components work together to keep these attributes up-to-date on subsequent selection.
73
+ * When using the `d2l-list-item-nav` component and/or mixin, usage of the `current` attribute adds the `aria-current` attribute to "page" for the `current` item and "location" for any parent and ancestors of the item. The components work together to keep these attributes up-to-date on subsequent selection.
74
74
 
75
75
  * Usage of the new `current` attribute over the existing `selected` attribute corresponds to `aria-current` and also leaves open the possibility of using both `current` and selection behavior together.
76
76
 
@@ -635,6 +635,7 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
635
635
 
636
636
  | Property | Type | Description |
637
637
  |---|---|---|
638
+ | `keyboard-drag-disabled` | Boolean | Disables keyboard dragging interaction. If enabled while implementing drag & drop, a keyboard alternative should be provided for the dragging functionality. |
638
639
  | `draggable` | Boolean | Whether the item is draggable |
639
640
  | `drag-handle-text` | String | The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode. |
640
641
  | `drag-target-handle-only` | Boolean | Make the drag target the drag handle only. |
@@ -23,6 +23,7 @@ class ListDemoNested extends LitElement {
23
23
  demoItemKey: { type: String, attribute: 'demo-item-key' },
24
24
  isDraggable: { attribute: 'is-draggable', type: Boolean },
25
25
  selectable: { type: Boolean },
26
+ keyboardDragDisabled: { type: Boolean, attribute: 'keyboard-drag-disabled' },
26
27
  disableExpandFeature: { type: Boolean, attribute: 'disable-expand-feature' },
27
28
  expanded: { type: Boolean },
28
29
  includeSecondaryActions: { type: Boolean, attribute: 'include-secondary-actions' },
@@ -203,6 +204,7 @@ class ListDemoNested extends LitElement {
203
204
  return html`
204
205
  <d2l-list-item
205
206
  action-href="${this.includeActionHref ? 'http://www.d2l.com' : ''}"
207
+ ?keyboard-drag-disabled="${this.keyboardDragDisabled}"
206
208
  ?draggable="${this.isDraggable}"
207
209
  drag-handle-text="${item.primaryText}"
208
210
  ?drop-nested="${item.dropNested}"
@@ -46,6 +46,14 @@
46
46
  </template>
47
47
  </d2l-demo-snippet>
48
48
 
49
+ <h2>Disable Keyboard Drag</h2>
50
+
51
+ <d2l-demo-snippet>
52
+ <template>
53
+ <d2l-demo-list-nested demo-item-key="imgPrimaryAndSupporting" is-draggable selectable keyboard-drag-disabled></d2l-demo-list-nested>
54
+ </template>
55
+ </d2l-demo-snippet>
56
+
49
57
 
50
58
  </d2l-demo-page>
51
59
 
@@ -250,6 +250,11 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
250
250
 
251
251
  static get properties() {
252
252
  return {
253
+ /**
254
+ * **Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.
255
+ * @type {boolean}
256
+ */
257
+ keyboardDragDisabled: { type: Boolean, attribute: 'keyboard-drag-disabled' },
253
258
  /**
254
259
  * **Drag & drop:** Whether the item is draggable
255
260
  * @type {boolean}
@@ -862,6 +867,7 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
862
867
  <d2l-list-item-drag-handle
863
868
  id="${this._itemDragId}"
864
869
  class="${classMap(classes)}"
870
+ ?disabled="${this.keyboardDragDisabled}"
865
871
  text="${ifDefined(this.dragHandleText)}"
866
872
  keyboard-text-info="${ifDefined(this._keyboardTextInfo)}"
867
873
  @focusin="${this._onFocusinDragHandle}"
@@ -174,12 +174,7 @@ class ListItemDragHandle extends LocalizeCoreElement(FocusMixin(LitElement)) {
174
174
  }
175
175
 
176
176
  _onDraggerButtonClick() {
177
- this.activateKeyboardMode();
178
- }
179
-
180
- _onDraggerButtonKeydown(e) {
181
- if (e.keyCode !== keyCodes.ENTER && e.keyCode !== keyCodes.SPACE) return;
182
- e.preventDefault();
177
+ if (this.disabled) return;
183
178
  this.activateKeyboardMode();
184
179
  }
185
180
 
@@ -287,7 +282,6 @@ class ListItemDragHandle extends LocalizeCoreElement(FocusMixin(LitElement)) {
287
282
  <button
288
283
  class="d2l-list-item-drag-handle-dragger-button d2l-list-item-drag-handle-button"
289
284
  @click="${this._onDraggerButtonClick}"
290
- @keydown="${this._onDraggerButtonKeydown}"
291
285
  aria-label="${this._defaultLabel}"
292
286
  ?disabled="${this.disabled}">
293
287
  <d2l-icon icon="tier1:dragger" class="d2l-button-dragger-icon"></d2l-icon>
@@ -8,8 +8,6 @@ import { menuItemStyles } from './menu-item-styles.js';
8
8
 
9
9
  const newWindowIconEnabled = getFlag('GAUD-8295-menu-item-link-new-window-icon', true);
10
10
 
11
- const menuItemClickChangesEnabled = getFlag('GAUD-8369-menu-item-link-click-changes', true);
12
-
13
11
  /**
14
12
  * A menu item component used for navigating.
15
13
  * @fires click - Dispatched when the link is clicked
@@ -105,7 +103,6 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
105
103
 
106
104
  firstUpdated() {
107
105
  super.firstUpdated();
108
- if (!menuItemClickChangesEnabled) this.addEventListener('click', this._onClick); // remove when cleaning up GAUD-8369-menu-item-link-click-changes
109
106
  this.addEventListener('keydown', this._onKeyDown);
110
107
  }
111
108
 
@@ -142,41 +139,9 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
142
139
  return label && this.target === '_blank' ? this.localize('components.link.open-in-new-window') : undefined;
143
140
  }
144
141
 
145
- // remove this function when cleaning up GAUD-8369-menu-item-link-click-changes
146
- _getTarget() {
147
- if (this.target && this.target !== '') {
148
- return this.target;
149
- }
150
- let base = document.getElementsByTagName('base');
151
- if (base && base.length > 0) {
152
- base = base[0];
153
- return base.getAttribute('target');
154
- }
155
- return null;
156
- }
157
-
158
- // remove this function when cleaning up GAUD-8369-menu-item-link-click-changes
159
- _onClick() {
160
- if (this.shadowRoot) this.shadowRoot.querySelector('a').dispatchEvent(new CustomEvent('click'));
161
- }
162
-
163
142
  _onKeyDown(e) {
164
- if (menuItemClickChangesEnabled) {
165
- if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
166
- this.shadowRoot.querySelector('a').click();
167
- }
168
- } else { // remove this block when cleaning up GAUD-8369-menu-item-link-click-changes
169
- super._onKeyDown(e);
170
- if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
171
- const target = this._getTarget();
172
- if (target === '_parent') {
173
- window.parent.location.assign(this.href);
174
- } else if (target === '_top') {
175
- window.top.location.assign(this.href);
176
- } else {
177
- window.location.assign(this.href);
178
- }
179
- }
143
+ if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
144
+ this.shadowRoot.querySelector('a').click();
180
145
  }
181
146
  }
182
147
  }
@@ -1,8 +1,6 @@
1
- import { getFlag } from '../../helpers/flags.js';
2
1
  import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
3
2
 
4
3
  const defaultLines = 2;
5
- const menuItemClickChangesEnabled = getFlag('GAUD-8369-menu-item-link-click-changes', true);
6
4
 
7
5
  export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(superclass) {
8
6
 
@@ -156,11 +154,7 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
156
154
  }
157
155
 
158
156
  __onClick(e) {
159
- if (menuItemClickChangesEnabled) {
160
- if (!this._letClickPropagate) e.stopPropagation();
161
- } else { // remove this block when cleaning up GAUD-8369-menu-item-link-click-changes
162
- e.stopPropagation();
163
- }
157
+ if (!this._letClickPropagate) e.stopPropagation();
164
158
 
165
159
  this.__action();
166
160
  }
@@ -8677,6 +8677,10 @@
8677
8677
  "name": "selectable",
8678
8678
  "type": "boolean"
8679
8679
  },
8680
+ {
8681
+ "name": "keyboard-drag-disabled",
8682
+ "type": "boolean"
8683
+ },
8680
8684
  {
8681
8685
  "name": "disable-expand-feature",
8682
8686
  "type": "boolean"
@@ -8735,6 +8739,11 @@
8735
8739
  "attribute": "selectable",
8736
8740
  "type": "boolean"
8737
8741
  },
8742
+ {
8743
+ "name": "keyboardDragDisabled",
8744
+ "attribute": "keyboard-drag-disabled",
8745
+ "type": "boolean"
8746
+ },
8738
8747
  {
8739
8748
  "name": "disableExpandFeature",
8740
8749
  "attribute": "disable-expand-feature",
@@ -8931,6 +8940,11 @@
8931
8940
  "type": "boolean",
8932
8941
  "default": "false"
8933
8942
  },
8943
+ {
8944
+ "name": "keyboard-drag-disabled",
8945
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
8946
+ "type": "boolean"
8947
+ },
8934
8948
  {
8935
8949
  "name": "drag-handle-text",
8936
8950
  "description": "**Drag & drop:** The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode.",
@@ -9052,6 +9066,12 @@
9052
9066
  {
9053
9067
  "name": "selectionInfo"
9054
9068
  },
9069
+ {
9070
+ "name": "keyboardDragDisabled",
9071
+ "attribute": "keyboard-drag-disabled",
9072
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
9073
+ "type": "boolean"
9074
+ },
9055
9075
  {
9056
9076
  "name": "dragHandleText",
9057
9077
  "attribute": "drag-handle-text",
@@ -9292,6 +9312,11 @@
9292
9312
  "type": "boolean",
9293
9313
  "default": "false"
9294
9314
  },
9315
+ {
9316
+ "name": "keyboard-drag-disabled",
9317
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
9318
+ "type": "boolean"
9319
+ },
9295
9320
  {
9296
9321
  "name": "drag-handle-text",
9297
9322
  "description": "**Drag & drop:** The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode.",
@@ -9420,6 +9445,12 @@
9420
9445
  {
9421
9446
  "name": "selectionInfo"
9422
9447
  },
9448
+ {
9449
+ "name": "keyboardDragDisabled",
9450
+ "attribute": "keyboard-drag-disabled",
9451
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
9452
+ "type": "boolean"
9453
+ },
9423
9454
  {
9424
9455
  "name": "dragHandleText",
9425
9456
  "attribute": "drag-handle-text",
@@ -9790,6 +9821,11 @@
9790
9821
  "type": "boolean",
9791
9822
  "default": "false"
9792
9823
  },
9824
+ {
9825
+ "name": "keyboard-drag-disabled",
9826
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
9827
+ "type": "boolean"
9828
+ },
9793
9829
  {
9794
9830
  "name": "drag-handle-text",
9795
9831
  "description": "**Drag & drop:** The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode.",
@@ -9930,6 +9966,12 @@
9930
9966
  {
9931
9967
  "name": "selectionInfo"
9932
9968
  },
9969
+ {
9970
+ "name": "keyboardDragDisabled",
9971
+ "attribute": "keyboard-drag-disabled",
9972
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
9973
+ "type": "boolean"
9974
+ },
9933
9975
  {
9934
9976
  "name": "dragHandleText",
9935
9977
  "attribute": "drag-handle-text",
@@ -10104,6 +10146,11 @@
10104
10146
  "type": "boolean",
10105
10147
  "default": "false"
10106
10148
  },
10149
+ {
10150
+ "name": "keyboard-drag-disabled",
10151
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
10152
+ "type": "boolean"
10153
+ },
10107
10154
  {
10108
10155
  "name": "drag-handle-text",
10109
10156
  "description": "**Drag & drop:** The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode.",
@@ -10237,6 +10284,12 @@
10237
10284
  {
10238
10285
  "name": "selectionInfo"
10239
10286
  },
10287
+ {
10288
+ "name": "keyboardDragDisabled",
10289
+ "attribute": "keyboard-drag-disabled",
10290
+ "description": "**Drag & drop:** Disables keyboard dragging interaction. If draggable, a keyboard alternative should be provided for the dragging functionality.",
10291
+ "type": "boolean"
10292
+ },
10240
10293
  {
10241
10294
  "name": "dragHandleText",
10242
10295
  "attribute": "drag-handle-text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.179.0",
3
+ "version": "3.181.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",