Skip to content

fix(dockview-core): popout-window pointer drags + cross-group maximize focus#1371

Merged
mathuo merged 2 commits into
v8-branchfrom
fix/popout-pointer-drag-and-maximize-focus
Jun 23, 2026
Merged

fix(dockview-core): popout-window pointer drags + cross-group maximize focus#1371
mathuo merged 2 commits into
v8-branchfrom
fix/popout-pointer-drag-and-maximize-focus

Conversation

@mathuo

@mathuo mathuo commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Two popout-window correctness niches found while completing cross-window accessibility (split out from the a11y PR per request — these are general bugs, not a11y-only).

1. Pointer drags dead inside a popout window

splitview (sash) and scrollbar attached their pointermove / pointerup / pointercancel (and the sash's contextmenu) listeners to the module-global document — i.e. the opener, not the popout. A drag begun inside a popped-out window dispatched its move/up events in the popout's document, which the opener's listeners never heard, so resizing a split (and dragging a scrollbar) was dead in a popout.

Fix: bind each drag to the dragged element's own ownerDocument (and shield iframes in that document). This affects mouse users too, not just keyboard/a11y.

2. Cross-group maximize stranded focus on <body>

Maximizing a different group than the focused one hides the focused group's DOM, blurring the focused element — and nothing pulled focus back. AccessibilityService already snapshots/restores focus across a remove; this extends the same was-inside / not-inside guard to the maximize mutation. Because of that guard, maximizing the focused group in place stays a no-op, so a mouse user who maximizes is never robbed of focus.

Test

Cross-document / hidden-element-blur behaviour isn't reachable in jsdom, so it's split between unit + the Playwright harness:

  • module unit (accessibilityDocking.spec, 108): maximizing another group restores focus into the maximized group. jsdom doesn't blur a hidden element, so the blur is emulated during the will phase; setActive doesn't move DOM focus, so the focusContent spy isolates the restore.
  • e2e (popout-pointer-drag.spec): a sash dragged inside a popout resizes its split — passes only because the listeners now live on the popout document. (Scrollbar shares the identical one-line fix.)
  • Green: 2 e2e + 108 dockview-modules + 1074 dockview-core.

Note

Targets v8-branch (where the e2e harness lives). These are real v7 bugs too; can be cherry-picked to master if a v7 patch is wanted. Touches accessibilityService.ts, which PR #1368 also edits — expect a small merge resolution in that file whichever merges second.

🤖 Generated with Claude Code

mathuo and others added 2 commits June 23, 2026 21:48
…e focus

Two popout-window correctness niches surfaced while completing cross-window a11y.

1. Sash + scrollbar pointer drags were dead inside a popout. `splitview` and
   `scrollbar` attached their `pointermove`/`pointerup`/`pointercancel` (and the
   sash's `contextmenu`) listeners to the module-global `document` — the opener,
   not the popout — so a drag begun in a popped-out window was never heard.
   Bind the drag to the dragged element's own `ownerDocument` instead (also
   shields iframes in that document). Affects mouse users too, not just a11y.

2. Maximizing a *different* group than the focused one stranded focus on
   `<body>`: that group's DOM is hidden, blurring the focused element, and
   nothing pulled focus back. AccessibilityService already snapshots/restores
   focus across a `remove`; extend the same was-inside / not-inside guard to the
   `maximize` mutation. The guard means maximizing the focused group in place is
   still a no-op, so mouse users are never robbed of focus.

Test:
- module unit: maximize-into-another-group restores focus into the maximized
  group (jsdom can't blur a hidden element, so the hidden-element blur is
  emulated in the will phase; `setActive` doesn't move focus, so the
  focusContent spy isolates the restore). 108 modules green.
- e2e `popout-pointer-drag.spec`: a sash dragged inside a popout resizes its
  split — only passes because the listeners now live on the popout document.
- 1074 core green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…er-drag-and-maximize-focus

# Conflicts:
#	e2e/fixtures/index.html
#	packages/dockview-modules/src/accessibilityService.ts
@sonarqubecloud

Copy link
Copy Markdown

@mathuo mathuo merged commit dade17a into v8-branch Jun 23, 2026
9 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.

1 participant