@vaadin/overlay 24.3.9 → 24.3.11

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/overlay",
3
- "version": "24.3.9",
3
+ "version": "24.3.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,11 +36,11 @@
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "~24.3.9",
40
- "@vaadin/component-base": "~24.3.9",
41
- "@vaadin/vaadin-lumo-styles": "~24.3.9",
42
- "@vaadin/vaadin-material-styles": "~24.3.9",
43
- "@vaadin/vaadin-themable-mixin": "~24.3.9"
39
+ "@vaadin/a11y-base": "~24.3.11",
40
+ "@vaadin/component-base": "~24.3.11",
41
+ "@vaadin/vaadin-lumo-styles": "~24.3.11",
42
+ "@vaadin/vaadin-material-styles": "~24.3.11",
43
+ "@vaadin/vaadin-themable-mixin": "~24.3.11"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@esm-bundle/chai": "^4.3.4",
@@ -48,5 +48,5 @@
48
48
  "lit": "^3.0.0",
49
49
  "sinon": "^13.0.2"
50
50
  },
51
- "gitHead": "89f71cc95b22840de910070c145f9cbf9714f4f4"
51
+ "gitHead": "890abeb0937416074456782aa90ed92c1bfe9cac"
52
52
  }
@@ -220,12 +220,13 @@ export const OverlayMixin = (superClass) =>
220
220
  this._oldOwner = owner;
221
221
 
222
222
  const rendererChanged = this._oldRenderer !== renderer;
223
+ const hasOldRenderer = this._oldRenderer !== undefined;
223
224
  this._oldRenderer = renderer;
224
225
 
225
226
  const openedChanged = this._oldOpened !== opened;
226
227
  this._oldOpened = opened;
227
228
 
228
- if (rendererChanged) {
229
+ if (rendererChanged && hasOldRenderer) {
229
230
  this.innerHTML = '';
230
231
  // Whenever a Lit-based renderer is used, it assigns a Lit part to the node it was rendered into.
231
232
  // When clearing the rendered content, this part needs to be manually disposed of.
@@ -146,7 +146,8 @@ export const PositionMixin = (superClass) =>
146
146
 
147
147
  /** @private */
148
148
  __addUpdatePositionEventListeners() {
149
- window.addEventListener('resize', this._updatePosition);
149
+ window.visualViewport.addEventListener('resize', this._updatePosition);
150
+ window.visualViewport.addEventListener('scroll', this.__onScroll, true);
150
151
 
151
152
  this.__positionTargetAncestorRootNodes = getAncestorRootNodes(this.positionTarget);
152
153
  this.__positionTargetAncestorRootNodes.forEach((node) => {
@@ -156,7 +157,8 @@ export const PositionMixin = (superClass) =>
156
157
 
157
158
  /** @private */
158
159
  __removeUpdatePositionEventListeners() {
159
- window.removeEventListener('resize', this._updatePosition);
160
+ window.visualViewport.removeEventListener('resize', this._updatePosition);
161
+ window.visualViewport.removeEventListener('scroll', this.__onScroll, true);
160
162
 
161
163
  if (this.__positionTargetAncestorRootNodes) {
162
164
  this.__positionTargetAncestorRootNodes.forEach((node) => {
@@ -204,9 +206,11 @@ export const PositionMixin = (superClass) =>
204
206
  /** @private */
205
207
  __onScroll(e) {
206
208
  // If the scroll event occurred inside the overlay, ignore it.
207
- if (!this.contains(e.target)) {
208
- this._updatePosition();
209
+ if (e.target instanceof Node && this.contains(e.target)) {
210
+ return;
209
211
  }
212
+
213
+ this._updatePosition();
210
214
  }
211
215
 
212
216
  _updatePosition() {
@@ -39,7 +39,8 @@ export const overlayStyles = css`
39
39
  }
40
40
 
41
41
  :host([hidden]),
42
- :host(:not([opened]):not([closing])) {
42
+ :host(:not([opened]):not([closing])),
43
+ :host(:not([opened]):not([closing])) [part='overlay'] {
43
44
  display: none !important;
44
45
  }
45
46