Skip to content

Fix floating Codex++ menu overlapping long thread titles#75

Merged
BigPizzaV3 merged 2 commits into
BigPizzaV3:mainfrom
shallFun4Learning:fix/header-menu-overlap
May 14, 2026
Merged

Fix floating Codex++ menu overlapping long thread titles#75
BigPizzaV3 merged 2 commits into
BigPizzaV3:mainfrom
shallFun4Learning:fix/header-menu-overlap

Conversation

@shallFun4Learning
Copy link
Copy Markdown
Contributor

Summary

This PR fixes a header layout regression where the floating Codex++ menu can overlap long thread titles in Codex Desktop.

Problem

When the thread title is short, the floating Codex++ label appears in the expected position.

When the thread title is long, the floating Codex++ label can shift left into the title area and visually overlap the thread title text.

This is not a sidebar issue, and it is not a generic text truncation problem in the title itself. It is a regression in the floating menu positioning logic.

This regression was introduced by commit 0e7175a (refactor: 标题、操作确认样式优化).

As shown in the figure:
image

When Codex++ cannot be inserted into the native menu area, it falls back to the floating header mode (codex-plus-menu-floating) and uses updateFloatingCodexPlusMenuPosition() to choose a header button as its positioning anchor.

The anchor selection in that refactor was too broad. It treated any header button on the right half of the window as a possible anchor:

  • header button
  • not inside Codex++
  • positioned on the right half of the window

That also includes the thread-title action button (...) inside the title region.

In long-title scenarios, the floating Codex++ menu was therefore anchored against a button inside the title region instead of the real right-side toolbar cluster, which caused the overlap.

I confirmed this by inspecting the live Codex header DOM through CDP:

  • the title-region button lives inside the title container
  • the real right-side toolbar buttons live inside .ms-auto.flex.shrink-0.items-center
  • the old logic could incorrectly treat the title-region button as the floating menu anchor

Fix

  • Added isHeaderToolbarButton(button, header)
  • Explicitly excluded buttons inside the title region (header.children[2])
  • Restricted floating-menu anchor candidates to the real right-side toolbar cluster

Result

  • Codex++ no longer anchors itself to the title-region ... button
  • long thread titles no longer overlap the floating Codex++ label
  • existing native insertion behavior remains unchanged

Validation

Passed:

  • node --check codex_session_delete/inject/renderer-inject.js
  • pytest -q tests/test_renderer_script.py tests/test_cdp.py

Result:

  • 37 passed

Screenshot

image

Copilot AI review requested due to automatic review settings May 13, 2026 13:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Codex Desktop header layout regression where the floating Codex++ menu could anchor to a button inside the thread title region (e.g., the ... menu), causing overlap with long thread titles. It narrows the anchor-candidate logic so the floating menu positions relative to the actual right-side header toolbar cluster.

Changes:

  • Added isHeaderToolbarButton(button, header) to more precisely filter eligible header toolbar buttons for anchoring.
  • Updated floating-menu positioning logic to use the new toolbar-button predicate instead of broad “right half of window” matching.
  • Extended renderer-inject contract tests to assert the presence of the new anchor-selection logic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
codex_session_delete/inject/renderer-inject.js Tightens floating Codex++ menu anchor selection to avoid title-region buttons and prevent overlap with long titles.
tests/test_renderer_script.py Adds assertions ensuring the updated floating-anchor selection logic remains present in the injected renderer script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread codex_session_delete/inject/renderer-inject.js Outdated
Comment thread codex_session_delete/inject/renderer-inject.js
@BigPizzaV3 BigPizzaV3 merged commit 6435c5c into BigPizzaV3:main May 14, 2026
@shallFun4Learning shallFun4Learning deleted the fix/header-menu-overlap branch May 14, 2026 06:58
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.

3 participants