Skip to content

fix(hub-ui): observe dock sidebar size in the popup's own realm - #218

Merged
antfu merged 1 commit into
mainfrom
fix/dock-sidebar-popup-resize
Aug 14, 2026
Merged

fix(hub-ui): observe dock sidebar size in the popup's own realm#218
antfu merged 1 commit into
mainfrom
fix/dock-sidebar-popup-resize

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Summary

Ports vitejs/devtools#521 (by @SaKaNa-Y) to this repo's fork of the dock sidebar.

In popup dock mode, resizing the popup window didn't update the dock sidebar group rail immediately:

  • Shrinking the popup didn't collapse the rail into the overflow ("more") icon as expected.
  • Enlarging the popup didn't restore hidden icons immediately.
  • The state only updated after the mouse moved into the host page.

Root cause

DockGroupSidebar.vue measured its height with useElementBounding, which listens for resize on the global window — the host page's window. In popup dock mode the sidebar renders inside the popup's own realm (its own document/window), so resizing the popup never fired that listener; the size only updated on the next event that happened to touch the host window (e.g. a mousemove there).

Fix

Same approach as the upstream fix: bind a ResizeObserver directly to the sidebar element via element.ownerDocument.defaultView.ResizeObserver, so it observes in whichever realm the element actually lives in, falling back to globalThis.ResizeObserver when unavailable.

Closes #207.

Diff for reference: https://github.com/vitejs/devtools/pull/521/files


PR generated with the help of an agent.

Port of vitejs/devtools#521. In popup dock mode the sidebar's ResizeObserver
was bound implicitly to the host window via useElementBounding, so resizing
the popup didn't update the group rail (collapsing into the overflow "more"
icon, or restoring hidden icons) until the mouse moved back into the host
page. Bind the observer through the sidebar element's own document/window
instead.

Co-authored-by: SaKaNa-Y <185575200+SaKaNa-Y@users.noreply.github.com>
@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 872a066
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a7ea8977cba370008ba1357
😎 Deploy Preview https://deploy-preview-218--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu
antfu merged commit 86375d3 into main Aug 14, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port fix from vitejs/devtools#521: observe dock sidebar size in the popup's own realm

2 participants