Skip to content

fix: detached glass empty after edge-split drop#56

Merged
ohxyz merged 2 commits into
mainfrom
fix/missing-content-in-detached-glass-after-original-glass-swaps-place
Jun 11, 2026
Merged

fix: detached glass empty after edge-split drop#56
ohxyz merged 2 commits into
mainfrom
fix/missing-content-in-detached-glass-after-original-glass-swaps-place

Conversation

@ohxyz

@ohxyz ohxyz commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

After dragging a glass and dropping it onto a pane edge (top/right/bottom/left), clicking the glass's detach button produced an empty detached glass — no title, no content.

Root cause

The edge-split drop path in src/binary-window/glass/drag.js did:

const newPaneSash = this.addPane(sash.id, { position: dropArea, id: oldSashId });
newPaneSash.domNode.append(activeDragGlassEl);

But BinaryWindow.addPane always seeds the new pane with its own empty placeholder Glass. Appending the dragged glass left the pane with two bw-glass elements (empty first, real second). The detach action reads the glass via paneEl.querySelector('bw-glass-content'), which returns the first (empty) match — hence the blank detached glass.

The center-swap path was unaffected.

Fix

Use replaceChildren instead of append, so the relocated pane holds exactly the dragged glass.

Notes

  • Verified with a scratch test driving the real onPaneDrop handler (failed before, passed after); full suite green (26/26).
  • Also tightens the Comments convention in CLAUDE.md (backtick code keywords).

ohxyz added 2 commits June 11, 2026 11:39
Edge-split drop appended the dragged glass alongside the empty
placeholder glass that addPane seeds, leaving two glasses in the pane.
Detach then read the empty one via querySelector. Use replaceChildren
so the pane holds only the dragged glass.
@ohxyz ohxyz merged commit c773e71 into main Jun 11, 2026
@ohxyz ohxyz deleted the fix/missing-content-in-detached-glass-after-original-glass-swaps-place branch June 11, 2026 01:45
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