@brightspace-ui/core 1.197.4 → 1.198.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.
@@ -64,7 +64,6 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
64
64
  this.__onMouseUp = this.__onMouseUp.bind(this);
65
65
  this.__onMouseEnter = this.__onMouseEnter.bind(this);
66
66
  this.__onMouseLeave = this.__onMouseLeave.bind(this);
67
- this.__onTouchStart = this.__onTouchStart.bind(this);
68
67
  this._contentRendered = null;
69
68
  this._openerRendered = null;
70
69
  }
@@ -77,7 +76,6 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
77
76
  this.addEventListener('mouseup', this.__onMouseUp);
78
77
  this.addEventListener('mouseenter', this.__onMouseEnter);
79
78
  this.addEventListener('mouseleave', this.__onMouseLeave);
80
- this.addEventListener('touchstart', this.__onTouchStart);
81
79
 
82
80
  if (this.openOnHover) {
83
81
  document.body.addEventListener('mouseup', this._onOutsideClick);
@@ -91,7 +89,6 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
91
89
  this.removeEventListener('mouseup', this.__onMouseUp);
92
90
  this.removeEventListener('mouseenter', this.__onMouseEnter);
93
91
  this.removeEventListener('mouseleave', this.__onMouseLeave);
94
- this.removeEventListener('touchstart', this.__onTouchStart);
95
92
 
96
93
  if (this.openOnHover) {
97
94
  document.body.removeEventListener('mouseup', this._onOutsideClick);
@@ -172,6 +169,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
172
169
  return;
173
170
  }
174
171
  content.toggleOpen(applyFocus);
172
+ this._isOpen = !this._isOpen;
175
173
  }
176
174
 
177
175
  __getContentElement() {
@@ -204,15 +202,22 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
204
202
  this._closeTimerStart();
205
203
  }
206
204
 
205
+ __onDropdownMouseUp() {
206
+ this._isOpen = true;
207
+ this._isFading = false;
208
+ this._isOpenedViaClick = true;
209
+ this._closeTimerStop();
210
+ }
211
+
207
212
  __onKeypress(e) {
208
- if (isComposedAncestor(e.srcElement, this.getOpenerElement())) {
213
+ if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
209
214
  this.__onOpenerKeyPress(e);
210
215
  }
211
216
  }
212
217
 
213
218
  __onMouseEnter(e) {
214
219
  if (!this.openOnHover) return;
215
- if (isComposedAncestor(e.srcElement, this.getOpenerElement())) {
220
+ if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
216
221
  this.__onOpenerMouseEnter(e);
217
222
  } else if (isComposedAncestor(this.__getContentElement(), e.srcElement)) {
218
223
  this.__onDropdownMouseEnter(e);
@@ -221,7 +226,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
221
226
 
222
227
  __onMouseLeave(e) {
223
228
  if (!this.openOnHover) return;
224
- if (isComposedAncestor(e.srcElement, this.getOpenerElement())) {
229
+ if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
225
230
  this.__onOpenerMouseLeave(e);
226
231
  } else if (isComposedAncestor(this.__getContentElement(), e.srcElement)) {
227
232
  this.__onDropdownMouseLeave(e);
@@ -229,8 +234,10 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
229
234
  }
230
235
 
231
236
  __onMouseUp(e) {
232
- if (isComposedAncestor(e.srcElement, this.getOpenerElement())) {
237
+ if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
233
238
  this.__onOpenerMouseUp(e);
239
+ } else if (this.openOnHover && isComposedAncestor(this.__getContentElement(), e.srcElement)) {
240
+ this.__onDropdownMouseUp();
234
241
  }
235
242
  }
236
243
 
@@ -296,27 +303,6 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
296
303
  } else this.toggleOpen(false);
297
304
  }
298
305
 
299
- /* used by open-on-hover option */
300
- __onOpenerTouch(e) {
301
- //Prevents touch from triggering mouseover/hover behavior
302
- e.preventDefault();
303
- this._closeTimerStop();
304
- if (this._isOpen) {
305
- this.closeDropdown();
306
- }
307
- else {
308
- this._isOpenedViaClick = true;
309
- this.openDropdown(true);
310
- }
311
- }
312
-
313
- __onTouchStart(e) {
314
- if (!this.openOnHover) return;
315
- if (isComposedAncestor(e.srcElement, this.getOpenerElement())) {
316
- this.__onOpenerTouch(e);
317
- }
318
- }
319
-
320
306
  /* used by open-on-hover option */
321
307
  _closeTimerStart() {
322
308
  if (this._isOpen) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.197.4",
3
+ "version": "1.198.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": {