@brightspace-ui/core 3.156.4 → 3.157.1

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.
@@ -4,6 +4,12 @@
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
5
  <meta charset="UTF-8">
6
6
  <link rel="stylesheet" href="../../demo/styles.css" type="text/css">
7
+ <script type="module">
8
+ import { mockFlag } from '../../../helpers/flags.js';
9
+ const urlParams = new URLSearchParams(window.location.search);
10
+ mockFlag('GAUD-8295-menu-item-link-new-window-icon', urlParams.get('link-new-window-icon') === 'true');
11
+ mockFlag('GAUD-8369-menu-item-link-click-changes', urlParams.get('link-click-changes') === 'true');
12
+ </script>
7
13
  <script type="module">
8
14
  import '../../demo/demo-page.js';
9
15
  import './custom-menu-item.js';
@@ -200,5 +206,12 @@
200
206
  </template>
201
207
  </d2l-demo-snippet>
202
208
  </d2l-demo-page>
209
+
210
+ <script>
211
+ document.addEventListener('click', e => {
212
+ if (e.target.tagName !== 'D2L-MENU-ITEM-LINK') return;
213
+ console.log('Click event propagated up for router!', e.target);
214
+ });
215
+ </script>
203
216
  </body>
204
217
  </html>
@@ -6,6 +6,7 @@ import { MenuItemMixin } from './menu-item-mixin.js';
6
6
  import { menuItemStyles } from './menu-item-styles.js';
7
7
 
8
8
  const newWindowIconEnabled = getFlag('GAUD-8295-menu-item-link-new-window-icon', true);
9
+ const menuItemClickChangesEnabled = getFlag('GAUD-8369-menu-item-link-click-changes', true);
9
10
 
10
11
  /**
11
12
  * A menu item component used for navigating.
@@ -90,9 +91,14 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
90
91
  ];
91
92
  }
92
93
 
94
+ constructor() {
95
+ super();
96
+ this._letClickPropagate = true;
97
+ }
98
+
93
99
  firstUpdated() {
94
100
  super.firstUpdated();
95
- this.addEventListener('click', this._onClick);
101
+ if (!menuItemClickChangesEnabled) this.addEventListener('click', this._onClick); // remove when cleaning up GAUD-8369-menu-item-link-click-changes
96
102
  this.addEventListener('keydown', this._onKeyDown);
97
103
  }
98
104
 
@@ -117,6 +123,7 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
117
123
 
118
124
  }
119
125
 
126
+ // remove this function when cleaning up GAUD-8369-menu-item-link-click-changes
120
127
  _getTarget() {
121
128
  if (this.target && this.target !== '') {
122
129
  return this.target;
@@ -129,19 +136,27 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
129
136
  return null;
130
137
  }
131
138
 
139
+ // remove this function when cleaning up GAUD-8369-menu-item-link-click-changes
132
140
  _onClick() {
133
141
  if (this.shadowRoot) this.shadowRoot.querySelector('a').dispatchEvent(new CustomEvent('click'));
134
142
  }
135
143
 
136
144
  _onKeyDown(e) {
137
- if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
138
- const target = this._getTarget();
139
- if (target === '_parent') {
140
- window.parent.location.assign(this.href);
141
- } else if (target === '_top') {
142
- window.top.location.assign(this.href);
143
- } else {
144
- window.location.assign(this.href);
145
+ if (menuItemClickChangesEnabled) {
146
+ if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
147
+ this.shadowRoot.querySelector('a').click();
148
+ }
149
+ } else { // remove this block when cleaning up GAUD-8369-menu-item-link-click-changes
150
+ super._onKeyDown(e);
151
+ if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
152
+ const target = this._getTarget();
153
+ if (target === '_parent') {
154
+ window.parent.location.assign(this.href);
155
+ } else if (target === '_top') {
156
+ window.top.location.assign(this.href);
157
+ } else {
158
+ window.location.assign(this.href);
159
+ }
145
160
  }
146
161
  }
147
162
  }
@@ -1,6 +1,8 @@
1
+ import { getFlag } from '../../helpers/flags.js';
1
2
  import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
2
3
 
3
4
  const defaultLines = 2;
5
+ const menuItemClickChangesEnabled = getFlag('GAUD-8369-menu-item-link-click-changes', true);
4
6
 
5
7
  export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(superclass) {
6
8
 
@@ -54,7 +56,8 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
54
56
  */
55
57
  description: { type: String },
56
58
  _ariaDisabled: { type: String, attribute: 'aria-disabled', reflect: true },
57
- _ariaLabel: { type: String, attribute: 'aria-label', reflect: true }
59
+ _ariaLabel: { type: String, attribute: 'aria-label', reflect: true },
60
+ _letClickPropagate: { state: true }
58
61
  };
59
62
  }
60
63
 
@@ -74,6 +77,7 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
74
77
  this.role = 'menuitem';
75
78
  /** @ignore */
76
79
  this.tabindex = -1;
80
+ this._letClickPropagate = false;
77
81
  }
78
82
 
79
83
  firstUpdated(changedProperties) {
@@ -82,7 +86,7 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
82
86
  this.addEventListener('click', this.__onClick);
83
87
  this.addEventListener('d2l-hierarchical-view-hide-complete', this.__onHideComplete);
84
88
  this.addEventListener('dom-change', this.__onDomChange);
85
- this.addEventListener('keydown', this.__onKeyDown);
89
+ this.addEventListener('keydown', this._onKeyDown);
86
90
 
87
91
  this.__initializeItem();
88
92
 
@@ -152,7 +156,12 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
152
156
  }
153
157
 
154
158
  __onClick(e) {
155
- e.stopPropagation();
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
+ }
164
+
156
165
  this.__action();
157
166
  }
158
167
 
@@ -171,7 +180,12 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
171
180
  this.setAttribute('tabindex', '0');
172
181
  }
173
182
 
174
- __onKeyDown(e) {
183
+ _onHidden() {
184
+ /** Dispatched when the visibility of the menu item changes */
185
+ this.dispatchEvent(new CustomEvent('d2l-menu-item-visibility-change', { bubbles: true, composed: true }));
186
+ }
187
+
188
+ _onKeyDown(e) {
175
189
  if (e.target !== this) {
176
190
  return;
177
191
  }
@@ -188,9 +202,4 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
188
202
  }
189
203
  }
190
204
 
191
- _onHidden() {
192
- /** Dispatched when the visibility of the menu item changes */
193
- this.dispatchEvent(new CustomEvent('d2l-menu-item-visibility-change', { bubbles: true, composed: true }));
194
- }
195
-
196
205
  };
package/lang/haw.js CHANGED
@@ -211,9 +211,9 @@ export default {
211
211
  "components.tag-list.num-hidden": "+ {count} hou aku",
212
212
  "components.tag-list.role-description":
213
213
  `{count, plural,
214
- =0 {Tag List with 0 items}
215
- one {Tag List with {count}i mea}
216
- other {Tag List with {count}a ʻē aʻe}
214
+ =0 {Papa inoa me 0 mau mea}
215
+ one {Papa inoa me {count} mau mea}
216
+ other {Papa inoa me {count} mau mea}
217
217
  }`,
218
218
  "components.tag-list.show-less": "Hōʻike liʻiliʻi",
219
219
  "components.tag-list.show-more-description": "E koho e hōʻike i nā mea papa inoa inoa huna",
package/lang/mi.js CHANGED
@@ -211,9 +211,9 @@ export default {
211
211
  "components.tag-list.num-hidden": "+ {count} anō",
212
212
  "components.tag-list.role-description":
213
213
  `{count, plural,
214
- =0 {Tag List with 0 items}
215
- one {Tag List with {count}ahi te mea}
216
- other {Tag List with {count}ētahi atu tūemi}
214
+ =0 {Rarangi Tohu me nga mea 0}
215
+ one {Rarangi Tohu me nga mea {count}}
216
+ other {Rarangi Tohu me nga mea {count}}
217
217
  }`,
218
218
  "components.tag-list.show-less": "Whakaaturia mai kia iti iho",
219
219
  "components.tag-list.show-more-description": "Tīpakohia hei whakaatu i ngā tūemi rārangi tūtohu hunahuna",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.156.4",
3
+ "version": "3.157.1",
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",