From a117955490c97be7304d6f8725edbbfcff17063a Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Thu, 3 Dec 2026 10:16:05 +0100 Subject: [PATCH] fix(web): the review item of #850 that goes on top The Dock button's hidden attribute was set only when a preview opened, so with a preview open, switching Codex files off left a Dock button that did nothing and switching it on showed none until the next preview. applyHeaderVisibilitySettings() now sets it beside the Response files button, and a test flips the setting with a preview open. Co-Authored-By: Claude Opus 5.5 --- src/web/public/settings-ui.js | 6 +++++- test/codex-file-previews-setting.test.ts | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/web/public/settings-ui.js b/src/web/public/settings-ui.js index 797ad8bd..85b6141e 100644 --- a/src/web/public/settings-ui.js +++ b/src/web/public/settings-ui.js @@ -4864,8 +4864,12 @@ Object.assign(CodemanApp.prototype, { } // Codex files (Response files button, sidebar file tabs, Dock) — opt-in, hidden by default. - // Switching it off takes a docked preview back to floating. + // Switching it off takes a docked preview back to floating. The Dock button follows the + // setting here too, not only when a preview opens: with a preview open, switching the setting + // off would otherwise leave a Dock button that does nothing, and on would show none. this._syncResponseFilesButton?.(); + const filePreviewDockBtn = document.getElementById('filePreviewDockBtn'); + if (filePreviewDockBtn) filePreviewDockBtn.hidden = !this._codexFilePreviewsEnabled?.(); if (!this._codexFilePreviewsEnabled?.()) this._setFilePreviewDocked?.(false); // Cron button (footer toolbar) — opt-in, hidden by default. Same marker pattern. diff --git a/test/codex-file-previews-setting.test.ts b/test/codex-file-previews-setting.test.ts index b1198afd..f1881392 100644 --- a/test/codex-file-previews-setting.test.ts +++ b/test/codex-file-previews-setting.test.ts @@ -159,6 +159,17 @@ describe('with the Codex files setting off (nothing stored), none of the three b expect(overlay.classList.contains('is-docked')).toBe(true); }); + it('flips the Dock button of an open preview when the setting changes, not only at the next open', () => { + const { app, document } = loadApp(); + const dockBtn = document.getElementById('filePreviewDockBtn')!; + app._codexFilePreviewsEnabled = () => true; + app.applyHeaderVisibilitySettings(); + expect(dockBtn.hidden).toBe(false); + app._codexFilePreviewsEnabled = () => false; + app.applyHeaderVisibilitySettings(); + expect(dockBtn.hidden).toBe(true); + }); + it('keeps Response files off phones even with the setting on', () => { const mobileCss = read('mobile.css'); const phoneBlock = mobileCss.slice(mobileCss.indexOf('@media (max-width: 599px)'));