Skip to content

Studio: mark the root when the chat wallpaper is ready instead of html:has() - #16117

Merged
danielhanchen merged 1 commit into
mainfrom
studio-wallpaper-titlebar-root-attribute
Oct 30, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-wallpaper-titlebar-root-attribute

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The 12th frontend failure #15973 (customizable chat background images and effects) left on main. #16116 fixes the other 11.

not ok - the titlebar dims for viewport backdrops without a :has() on the document root
  expected not to match /(?:^|[\s,{}(>~+])(?:html|body|:root)...:has\(/

To clear the Desktop titlebar over a ready wallpaper, #15973 added four rules of the form html:has(:is([data-wallpaper-workspace], [data-chat-content-root]) > .chat-wallpaper[data-ready]) [data-slot="window-titlebar"] .... The titlebar renders outside the wallpaper's subtree, so a plain descendant selector cannot reach it. A :has() whose subject is the document root, though, makes every DOM mutation anywhere a candidate for re-matching. That is why titlebar-modal-layering forbids it, and why the viewport-backdrop dimming next to it goes through a store and an attribute instead.

Here the product needed the change, not the test.

Change

  • ChatBackground sets data-chat-wallpaper-ready on <html> while the app's own wallpaper is ready, plus data-chat-wallpaper-workspace-ready when it sits in the workspace. The marks are reference-counted and removed when the wallpaper unmounts, deactivates or loses its frame.
  • The check reads the wallpaper's direct parent, the same > .chat-wallpaper relation the old selectors used. So the settings previews never mark the root, just as they never matched before.
  • The four rules now key off html[data-chat-wallpaper-ready] and html[data-chat-wallpaper-workspace-ready]. They are still unlayered, so they keep beating the titlebar's Tailwind utilities. The pinned-sidebar segment rule stays more specific than the transparent-controls rule, so it still wins.
  • titlebar-modal-layering matched data-slot="window-titlebar" immediately followed by data-viewport-backdrop-open=, and Studio: add customizable chat background images and effects #15973 had put data-wallpaper-sidebar-pinned between them. The pattern now allows other attributes inside the same opening tag.

Verification

  • tests/titlebar-modal-layering.test.ts and tests/chat-background.test.ts: 12 passed. On main the titlebar case fails.
  • Sabotage: restoring main's index.css fails the root :has() check, and dropping data-viewport-backdrop-open from the titlebar fails the attribute check.
  • Behaviour. The titlebar only renders in the Desktop app on Windows and Linux, so I measured it rather than screenshotting it. On smoke-chat-background.html I added stand-in window-titlebar (sidebar pinned, two data-wallpaper-chrome-controls) and window-titlebar-decoration elements, with base styles in @layer utilities like the real classes. Computed styles, main and this branch alike:
State titlebar bg / backdrop-filter first controls (pinned sidebar) bg other controls bg / backdrop-filter decoration <html> marks (branch)
no wallpaper red / blur(4px) red red / blur(4px) visible none
wallpaper ready transparent / none rgb(255, 255, 255) (--sidebar) transparent / none hidden ready, workspace-ready
after Reset all red / blur(4px) red red / blur(4px) visible none

Text shadow on the controls also matches (rgb(254, 254, 253) 0px 1px 8px when ready).

…l:has()

#15973 cleared the Desktop titlebar over a ready wallpaper with four html:has(...) rules,
which titlebar-modal-layering forbids: a :has() on the document root re-matches on every
DOM change. ChatBackground now sets data-chat-wallpaper-ready (and -workspace-ready) on
<html> while the app's own wallpaper is ready, ref-counted, and the rules key off those.
The guard's attribute check also allows other attributes on the titlebar's tag.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T12:19:55.895307Z 51d2f04 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 51d2f04ee7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 1952d23 into main Oct 30, 2026
1 of 46 checks passed
@danielhanchen
danielhanchen deleted the studio-wallpaper-titlebar-root-attribute branch October 30, 2026 12:46
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