@svgrid/grid 1.2.1 → 1.2.4

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.
@@ -191,7 +191,7 @@ export function createScrollSync<
191
191
  function onBodyScroll(event: Event) {
192
192
  const container = event.currentTarget as HTMLDivElement | null;
193
193
  if (!container) return;
194
- if (ctx.columnMenuFor || ctx.operatorMenuFor) ctx.closeMenus();
194
+ if (ctx.columnMenuFor || ctx.operatorMenuFor || ctx.contextMenuFor) ctx.closeMenus();
195
195
  scheduleScrollSync(container.scrollTop, container.scrollLeft);
196
196
  // Mirror horizontal scroll to any aligned grids in the same group.
197
197
  if (ctx.props.alignedGridGroup != null) ctx.broadcastAlignedScroll(container.scrollLeft);
@@ -160,6 +160,7 @@ class SvGridScrollbarElement extends ScrollbarBase {
160
160
  private valueStart = 0
161
161
  private holdTimer: ReturnType<typeof setTimeout> | null = null
162
162
  private resizeObserver: ResizeObserver | null = null
163
+ private resizeFrame = 0
163
164
 
164
165
  connectedCallback() {
165
166
  if (this.shadowRoot) return
@@ -187,7 +188,17 @@ class SvGridScrollbarElement extends ScrollbarBase {
187
188
  btn.addEventListener('pointercancel', this.stopHold)
188
189
  }
189
190
 
190
- this.resizeObserver = new ResizeObserver(() => this.render())
191
+ // Coalesce resize notifications into a single next-frame render so the
192
+ // observer callback never re-lays-out the observed element within the same
193
+ // delivery cycle (which is what triggers the benign but noisy
194
+ // "ResizeObserver loop completed with undelivered notifications" warning).
195
+ this.resizeObserver = new ResizeObserver(() => {
196
+ if (this.resizeFrame) return
197
+ this.resizeFrame = requestAnimationFrame(() => {
198
+ this.resizeFrame = 0
199
+ this.render()
200
+ })
201
+ })
191
202
  this.resizeObserver.observe(this)
192
203
 
193
204
  this.render()
@@ -195,6 +206,8 @@ class SvGridScrollbarElement extends ScrollbarBase {
195
206
 
196
207
  disconnectedCallback() {
197
208
  this.stopHold()
209
+ if (this.resizeFrame) cancelAnimationFrame(this.resizeFrame)
210
+ this.resizeFrame = 0
198
211
  this.resizeObserver?.disconnect()
199
212
  this.resizeObserver = null
200
213
  document.removeEventListener('pointermove', this.onPointerMove)