fix: detached glass shows 'null' in header when pane has no title#53
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Detaching a glass from a pane that has no title rendered the literal text
nullin the detached glass's header.Root cause
Glass.build()only created abw-glass-titleelement when a title was present. So when detaching a titleless pane:bw-glass-title→paneEl.querySelector('bw-glass-title')returnednull.detachedGlass.titleElementwasnull.titleEl.replaceWith(glassTitleEl)whereglassTitleElwasnull.ChildNode.replaceWith(null)coercesnullto the string"null", inserting it as a visible text node.Fix
Glassnow always creates abw-glass-titleelement, leaving it empty when no title is passed.Test plan
nulltext.dev/features/bwin-detached-glass.js: the bottom pane is now titleless to exercise this case manually.