@brightspace-ui/core 1.198.0 → 1.199.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.
|
@@ -60,10 +60,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
60
60
|
this._isHovering = false;
|
|
61
61
|
this._isFading = false;
|
|
62
62
|
|
|
63
|
-
this.
|
|
64
|
-
this.__onMouseUp = this.__onMouseUp.bind(this);
|
|
65
|
-
this.__onMouseEnter = this.__onMouseEnter.bind(this);
|
|
66
|
-
this.__onMouseLeave = this.__onMouseLeave.bind(this);
|
|
63
|
+
this._onOutsideClick = this._onOutsideClick.bind(this);
|
|
67
64
|
this._contentRendered = null;
|
|
68
65
|
this._openerRendered = null;
|
|
69
66
|
}
|
|
@@ -188,49 +185,50 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
188
185
|
this._isOpenedViaClick = false;
|
|
189
186
|
}
|
|
190
187
|
|
|
191
|
-
/* used by open-on-hover option */
|
|
192
|
-
__onDropdownMouseEnter() {
|
|
193
|
-
this._isOpen = true;
|
|
194
|
-
this._isFading = false;
|
|
195
|
-
this._closeTimerStop();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/* used by open-on-hover option */
|
|
199
|
-
__onDropdownMouseLeave(e) {
|
|
200
|
-
if (this.__getContentElement() !== e.target) return;
|
|
201
|
-
if (!this._isOpenedViaClick) this._isOpen = false;
|
|
202
|
-
this._closeTimerStart();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
188
|
__onDropdownMouseUp() {
|
|
206
189
|
this._isOpen = true;
|
|
207
190
|
this._isFading = false;
|
|
191
|
+
this._isHovering = false;
|
|
208
192
|
this._isOpenedViaClick = true;
|
|
209
193
|
this._closeTimerStop();
|
|
210
194
|
}
|
|
211
195
|
|
|
212
196
|
__onKeypress(e) {
|
|
213
197
|
if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
|
|
214
|
-
|
|
198
|
+
if (e.keyCode !== 13 && e.keyCode !== 32) return;
|
|
199
|
+
if (this.noAutoOpen) return;
|
|
200
|
+
if (!this.openOnHover) {
|
|
201
|
+
this.toggleOpen(true);
|
|
202
|
+
} else {
|
|
203
|
+
this._closeTimerStop();
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
this._isOpenedViaClick = true;
|
|
206
|
+
this.openDropdown(true);
|
|
207
|
+
}
|
|
215
208
|
}
|
|
216
209
|
}
|
|
217
210
|
|
|
218
|
-
__onMouseEnter(
|
|
211
|
+
async __onMouseEnter() {
|
|
219
212
|
if (!this.openOnHover) return;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
213
|
+
// do not respond to hover events on mobile screens
|
|
214
|
+
const dropdownContent = this.__getContentElement();
|
|
215
|
+
if (dropdownContent._useMobileStyling) return;
|
|
216
|
+
clearTimeout(this._dismissTimerId);
|
|
217
|
+
if (!this._isOpen) await this.openDropdown(false);
|
|
218
|
+
this._closeTimerStop();
|
|
219
|
+
if (!this._isOpenedViaClick) this._isHovering = true;
|
|
225
220
|
}
|
|
226
221
|
|
|
227
|
-
__onMouseLeave(
|
|
222
|
+
async __onMouseLeave() {
|
|
228
223
|
if (!this.openOnHover) return;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
224
|
+
// do not respond to hover events on mobile screens
|
|
225
|
+
const dropdownContent = this.__getContentElement();
|
|
226
|
+
if (dropdownContent._useMobileStyling) return;
|
|
227
|
+
this._isHovering = false;
|
|
228
|
+
if (this._isOpenedViaClick) return;
|
|
229
|
+
//Wait before closing so we don't lose hover when we jump from opener to card
|
|
230
|
+
clearTimeout(this._dismissTimerId);
|
|
231
|
+
await this.closeDropdown(true);
|
|
234
232
|
}
|
|
235
233
|
|
|
236
234
|
__onMouseUp(e) {
|
|
@@ -251,42 +249,6 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
251
249
|
this._isFading = false;
|
|
252
250
|
}
|
|
253
251
|
|
|
254
|
-
__onOpenerKeyPress(e) {
|
|
255
|
-
if (e.keyCode !== 13 && e.keyCode !== 32) return;
|
|
256
|
-
if (this.noAutoOpen) return;
|
|
257
|
-
if (!this.openOnHover) {
|
|
258
|
-
this.toggleOpen(true);
|
|
259
|
-
} else {
|
|
260
|
-
this._closeTimerStop();
|
|
261
|
-
e.preventDefault();
|
|
262
|
-
this._isOpenedViaClick = true;
|
|
263
|
-
this.openDropdown(true);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/* used by open-on-hover option */
|
|
268
|
-
async __onOpenerMouseEnter() {
|
|
269
|
-
// do not respond to hover events on mobile screens
|
|
270
|
-
const dropdownContent = this.__getContentElement();
|
|
271
|
-
if (dropdownContent._useMobileStyling) return;
|
|
272
|
-
clearTimeout(this._dismissTimerId);
|
|
273
|
-
if (!this._isOpen) await this.openDropdown(false);
|
|
274
|
-
this._closeTimerStop();
|
|
275
|
-
this._isHovering = true;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/* used by open-on-hover option */
|
|
279
|
-
async __onOpenerMouseLeave() {
|
|
280
|
-
// do not respond to hover events on mobile screens
|
|
281
|
-
const dropdownContent = this.__getContentElement();
|
|
282
|
-
if (dropdownContent._useMobileStyling) return;
|
|
283
|
-
this._isHovering = false;
|
|
284
|
-
if (this._isOpenedViaClick) return;
|
|
285
|
-
//Wait before closing so we don't lose hover when we jump from opener to card
|
|
286
|
-
clearTimeout(this._dismissTimerId);
|
|
287
|
-
await this.closeDropdown(true);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
252
|
__onOpenerMouseUp(e) {
|
|
291
253
|
if (this.noAutoOpen) return;
|
|
292
254
|
if (this.openOnHover) {
|
|
@@ -325,10 +287,11 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
325
287
|
_onOutsideClick(e) {
|
|
326
288
|
if (!this._isOpen) return;
|
|
327
289
|
const isWithinDropdown = isComposedAncestor(this.__getContentElement(), e.composedPath()[0]);
|
|
290
|
+
const isWithinOpener = isComposedAncestor(this.getOpenerElement(), e.composedPath()[0]);
|
|
328
291
|
const isBackdropClick = isWithinDropdown
|
|
329
292
|
&& this.__getContentElement()._useMobileStyling
|
|
330
293
|
&& e.composedPath().find(node => node.nodeName === 'D2L-BACKDROP');
|
|
331
|
-
if (!isWithinDropdown || isBackdropClick) {
|
|
294
|
+
if (!isWithinOpener && (!isWithinDropdown || isBackdropClick)) {
|
|
332
295
|
this.closeDropdown();
|
|
333
296
|
}
|
|
334
297
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.199.0",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"repository": "https://github.com/BrightspaceUI/core.git",
|
|
6
6
|
"publishConfig": {
|