Skip to content

Fix transparent active state on attachment delete button in composer - #3962

Merged
shaunandrews merged 3 commits into
trunkfrom
ai/agent/stu-1934-1782408605
Jun 29, 2026
Merged

Fix transparent active state on attachment delete button in composer#3962
shaunandrews merged 3 commits into
trunkfrom
ai/agent/stu-1934-1782408605

Conversation

@agent-sandbox-automattic

@agent-sandbox-automattic agent-sandbox-automattic Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Related issues

Fixes STU-1934

How AI was used in this PR

AI identified the root cause and authored the fix. Codex reviewed the original agent-generated change, found the remaining agentic UI focus-state gap, and added the follow-up fix.

Proposed Changes

When the attachment delete button is pressed, its background could become transparent because generic button reset styles were winning over the custom composer button styles.

The first pass only covered the :active state. The remaining intermittent failure was in the agentic UI pointer-focus transition: after a mouse press, the button can be :focus:not(:focus-visible) while no longer :active, and the global focus reset can pull in transparent WordPress UI button variables.

This update keeps the attachment remove button background opaque across hover, active, keyboard focus, pointer focus, and parent focus-within states in the agentic UI. It also reasserts the legacy Studio Code tab background with the background shorthand so reset shorthands cannot leak through.

Testing Instructions

  1. Open any chat composer (Studio Code tab or the agentic UI).
  2. Attach a text file, such as a CSV, using drag-and-drop or the paperclip button.
  3. Hover over the attachment tile so the remove button appears.
  4. Click and hold the remove button. The button background should stay opaque while pressed.
  5. Press the remove button, drag the pointer away, then release. The button should stay opaque while it retains focus.
  6. Repeat in light and dark mode.

Pre-merge Checklist

  • Changes are focused on the reported bug only
  • Tested in light mode
  • Tested in dark mode
  • Linter/formatter run on modified files (npx eslint --fix; CSS files are ignored by the repo ESLint config)
  • Type-checker passed (npm run typecheck)
  • Relevant tests passed (npm test -- apps/studio/src/components/studio-code-session/composer/index.test.tsx apps/ui/src/ui-classic/components/session-view/conversation/index.test.ts apps/ui/src/ui-classic/components/session-view/annotations.test.ts)

Linear: STU-1934

Co-authored-by: shaunandrews shaun@automattic.com

This PR was auto-generated by Agent Sandbox. Please review carefully before merging.

matticbot and others added 2 commits June 25, 2026 17:32
The attachment remove button went transparent when pressed because the
`:active` pseudo-state wasn't included in the background-color override
selectors. A global `[type='button'] { background-color: transparent }`
CSS reset was winning specificity during the active/pressed state.

Added `:active` to the hover/focus-visible selectors in both the Studio
Code composer (apps/studio) and the agentic UI classic composer (apps/ui).
In apps/studio the doubled-class pattern is preserved so the override
keeps the same specificity boost used to beat the global reset.

Co-Authored-By: shaunandrews <shaun@automattic.com>
@shaunandrews
shaunandrews marked this pull request as ready for review June 25, 2026 19:14
@shaunandrews
shaunandrews enabled auto-merge (squash) June 25, 2026 19:15
@shaunandrews
shaunandrews requested review from a team, bcotrim and sejas June 25, 2026 19:27

@gavande1 gavande1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice find. LGTM 👍

Before After
Image Image
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 0e49f8d vs trunk

app-size

Metric trunk 0e49f8d Diff Change
App Size (Mac) 1315.58 MB 1315.58 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 0e49f8d Diff Change
load 1080 ms 808 ms 272 ms 🟢 -25.2%

site-startup

Metric trunk 0e49f8d Diff Change
siteCreation 6513 ms 6485 ms 28 ms ⚪ 0.0%
siteStartup 6469 ms 6978 ms +509 ms 🔴 7.9%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@shaunandrews
shaunandrews merged commit d97e356 into trunk Jun 29, 2026
11 checks passed
@shaunandrews
shaunandrews deleted the ai/agent/stu-1934-1782408605 branch June 29, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants