Repository navigation
Conversation
CSS-only dim and hide modes scoped to html[it-zen-mode], plus a floating Exit Zen control and Escape as ways out. Off by default; no new permissions and no network requests.
chirag127
marked this pull request as ready for review
November 18, 2026 10:23
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.
Closes #4093.
What this adds
A Zen mode with two levels, set from Appearance → Zen mode:
When either mode is on, a small Exit Zen pill appears at the top right;
Escapealso leaves it. Both paths writezen_mode = offthrough the normal storage bridge, so the menu switch follows.Why CSS
The page regions are stable YouTube element ids (
ytd-masthead,#secondary,#comments,#below,#guide). Doing this in CSS means the setting applies before the page paints, with no layout script, no observer and no per-navigation work. Every rule is scoped tohtml[it-zen-mode="…"], the attribute the extension already writes for each stored setting; nothing is styled unless the user turns it on.The only JavaScript is the exit control (
features/zen.js), because a CSS-only feature has no way back out.Where it lives
js&css/extension/www.youtube.com/features/zen.csshtml[it-zen-mode]js&css/web-accessible/www.youtube.com/features/zen.jsmenu/skeleton-parts/zen.js_locales/en/messages.jsonmanifest.jsonjs&css/extension/init.js,menu/index.htmltests/unit/zen-mode.test.jsNo existing feature file is edited.
Verification
Live check in Chrome 157 on
youtube.com/watch, with the CSS injected andit-zen-mode="hide":Screenshot (hide mode, bright video so the player is visible):
Not tested
document,CustomEventand the existing message bridge.Conflicts
No open PR touches
features/zen.css,features/zen.js,menu/skeleton-parts/zen.jsortests/unit/zen-mode.test.js. The shared edits are one line each. The attribute is namespaced (it-zen-mode) and the feature is off by default.