@vaadin/context-menu 23.1.0-rc2 → 23.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/context-menu",
3
- "version": "23.1.0-rc2",
3
+ "version": "23.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,20 +37,20 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/component-base": "23.1.0-rc2",
41
- "@vaadin/item": "23.1.0-rc2",
42
- "@vaadin/list-box": "23.1.0-rc2",
43
- "@vaadin/lit-renderer": "23.1.0-rc2",
44
- "@vaadin/vaadin-lumo-styles": "23.1.0-rc2",
45
- "@vaadin/vaadin-material-styles": "23.1.0-rc2",
46
- "@vaadin/vaadin-overlay": "23.1.0-rc2",
47
- "@vaadin/vaadin-themable-mixin": "23.1.0-rc2"
40
+ "@vaadin/component-base": "^23.1.1",
41
+ "@vaadin/item": "^23.1.1",
42
+ "@vaadin/list-box": "^23.1.1",
43
+ "@vaadin/lit-renderer": "^23.1.1",
44
+ "@vaadin/vaadin-lumo-styles": "^23.1.1",
45
+ "@vaadin/vaadin-material-styles": "^23.1.1",
46
+ "@vaadin/vaadin-overlay": "^23.1.1",
47
+ "@vaadin/vaadin-themable-mixin": "^23.1.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@esm-bundle/chai": "^4.3.4",
51
- "@vaadin/polymer-legacy-adapter": "23.1.0-rc2",
51
+ "@vaadin/polymer-legacy-adapter": "^23.1.1",
52
52
  "@vaadin/testing-helpers": "^0.3.2",
53
53
  "sinon": "^13.0.2"
54
54
  },
55
- "gitHead": "154c6782c42145fed21e443559fbe2d781ad3ec7"
55
+ "gitHead": "390458d6519433a2dd502cef90da48e84573a275"
56
56
  }
@@ -34,8 +34,20 @@ register({
34
34
  }
35
35
  },
36
36
 
37
- touchstart(e) {
37
+ _setSourceEvent(e) {
38
38
  this.info.sourceEvent = e;
39
+
40
+ const path = e.composedPath();
41
+
42
+ // Calling `sourceEvent.composedPath()` after a timeout would return an empty array.
43
+ // This is especially problematic on iOS where we configure the timer on touchstart.
44
+ // Store the composed path to be used by `grid.getEventContext(event)` so it works.
45
+ this.info.sourceEvent.__composedPath = path;
46
+ },
47
+
48
+ touchstart(e) {
49
+ this._setSourceEvent(e);
50
+
39
51
  this.info.touchStartCoords = {
40
52
  x: e.changedTouches[0].clientX,
41
53
  y: e.changedTouches[0].clientY,
@@ -80,7 +92,7 @@ register({
80
92
 
81
93
  contextmenu(e) {
82
94
  if (!e.shiftKey) {
83
- this.info.sourceEvent = e;
95
+ this._setSourceEvent(e);
84
96
  this.fire(e.target, e.clientX, e.clientY);
85
97
  prevent('tap');
86
98
  }
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { flush } from '@polymer/polymer/lib/utils/flush.js';
7
6
  import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
8
7
  import { Item } from '@vaadin/item/src/vaadin-item.js';
9
8
  import { ListBox } from '@vaadin/list-box/src/vaadin-list-box.js';
@@ -273,20 +272,18 @@ export const ItemsMixin = (superClass) =>
273
272
  /** @private */
274
273
  __initMenu(root, menu) {
275
274
  if (!root.firstElementChild) {
276
- const is = this.constructor.is;
277
- root.innerHTML = `
278
- <vaadin-context-menu-list-box></vaadin-context-menu-list-box>
279
- <${is} hidden></${is}>
280
- `;
281
- flush();
282
- const listBox = root.querySelector('vaadin-context-menu-list-box');
275
+ const listBox = document.createElement('vaadin-context-menu-list-box');
276
+ root.appendChild(listBox);
277
+
283
278
  if (this._theme) {
284
279
  listBox.setAttribute('theme', this._theme);
285
280
  }
286
281
  listBox.classList.add('vaadin-menu-list-box');
287
282
  requestAnimationFrame(() => listBox.setAttribute('role', 'menu'));
288
283
 
289
- const subMenu = root.querySelector(is);
284
+ const subMenu = document.createElement(this.constructor.is);
285
+ subMenu.setAttribute('hidden', '');
286
+ root.appendChild(subMenu);
290
287
  subMenu.$.overlay.modeless = true;
291
288
  subMenu.openOn = 'opensubmenu';
292
289