Skip to content

fix: detached glass shows 'null' in header when pane has no title#53

Merged
ohxyz merged 1 commit into
mainfrom
fix/detached-glass-title-shows-null
Jun 9, 2026
Merged

fix: detached glass shows 'null' in header when pane has no title#53
ohxyz merged 1 commit into
mainfrom
fix/detached-glass-title-shows-null

Conversation

@ohxyz

@ohxyz ohxyz commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

Detaching a glass from a pane that has no title rendered the literal text null in the detached glass's header.

Root cause

Glass.build() only created a bw-glass-title element when a title was present. So when detaching a titleless pane:

  • The source pane had no bw-glass-titlepaneEl.querySelector('bw-glass-title') returned null.
  • The newly created detached glass also had no title element → detachedGlass.titleElement was null.
  • The fallback branch ran titleEl.replaceWith(glassTitleEl) where glassTitleEl was null. ChildNode.replaceWith(null) coerces null to the string "null", inserting it as a visible text node.

Fix

  • Glass now always creates a bw-glass-title element, leaving it empty when no title is passed.
  • With the title element guaranteed to exist, the detach handler's null-title fallback branch is dead code and is removed.

Test plan

  • Detach a pane with a title → title carries over as before.
  • Detach a pane without a title → empty header, no null text.
  • dev/features/bwin-detached-glass.js: the bottom pane is now titleless to exercise this case manually.

Glass now always creates a bw-glass-title element (empty when no title
is passed) instead of only when a title exists. Previously, detaching a
titleless pane left detachedGlass.titleElement null, so the fallback ran
replaceWith(null) — which coerces to the text node 'null'.

With the title element guaranteed, the detach handler's null-title
fallback branch is dead code and is removed.
@ohxyz ohxyz merged commit 06d7acc into main Jun 9, 2026
@ohxyz ohxyz deleted the fix/detached-glass-title-shows-null branch June 9, 2026 07:11
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