Skip to content

Automations: remove lingering :has() selectors from dialog and list - #325864

Merged
Ben Villalobos (benvillalobos) merged 5 commits into
mainfrom
bv/automation-css-audit
Jul 17, 2026
Merged

Ben Villalobos (benvillalobos) merged 5 commits into
mainfrom
bv/automation-css-audit

Conversation

@benvillalobos

Copy link
Copy Markdown
Member

Context

Follow-up to #324986 (which fixed #324985), the fix that removed the catastrophic body:has(.automation-dialog) rules causing persistent workbench-wide style-recalc jank. That PR removed the worst offenders, but the Automations UI still shipped four :has() selectors in aiCustomizationManagement.css. This is the audit follow-up that removes the rest.

This stylesheet is imported by eagerly-loaded chat-contrib modules, so its rules live in the global document stylesheet whenever the chat contrib is loaded — present in Stable even when the Automations feature is off (chat.automations.enabled defaults to false).

What changed

All four remaining :has() selectors are gone (a :has( grep now matches only explanatory comments):

Rule (before) After
.action-item:has(.action-label.codicon-{settings,add,server}) — hides 3 embedded chat-input chips Dropped at the source via a new hiddenInputToolbarActionIds ChatInputPart option (rendered as HiddenActionViewItem). No CSS needed.
.automations-row:has(:focus-visible) .automations-row:focus-within
.automations-row-wrapper:has(> .automations-row-history) (×2) JS-toggled .automations-row-wrapper-expanded class

Why the chip rule mattered most

.action-item is a workbench-wide element and codicon-settings/add/server are common toolbar icons, so .action-item:has(.action-label.codicon-*) registered :has() invalidation bookkeeping keyed on common classes across the whole workbench — the same bug family as the fixed body:has(), just lower severity (anchor is .action-item, not body). Hiding those chips at the view-item level (the codebase's established HiddenActionViewItem mechanism, already used for the phone Mode picker) removes them from layout and keyboard tab order with no :has().

Incidental fix

The .automations-row-history element is always present in the DOM, so :has(> .automations-row-history) matched every row regardless of expanded state — meaning collapsed rows silently lost their hover highlight and always had flattened bottom corners. The new .automations-row-wrapper-expanded class (toggled in automationsListWidget.ts renderElement) reflects the actual expanded state, restoring hover highlight on collapsed rows and only flattening the card corners when the run-history panel is expanded — which matches the original CSS comment's intent.

Notes for reviewers

  • No functional change to the chips shown in other chat surfaces — the hide is scoped to the automation dialog's ChatInputPart instance.
  • .action-item elements are still display:none (via HiddenActionViewItem), identical DOM ordering to before, so the existing inter-chip divider-suppression rule remains valid.
  • Two intentional visual behavior changes to spot-check: (1) collapsed automation rows now show a hover highlight; (2) the row focus ring now also appears on mouse-click focus of a row action button (:focus-within vs keyboard-only :focus-visible), consistent with the sibling tools/prompts lists' documented pattern.

Validation

  • npm run typecheck-client — passes
  • ESLint on changed TS — passes
  • stylelint on the CSS — passes (only pre-existing design-token suggestions, none introduced)
  • Pre-commit hygiene — passes

Draft while I run through the local visual test pass (enable chat.automations.enabled, open Open Customizations → Automations, exercise list hover/focus/expand and the create/edit dialog toolbar).

Copilot AI review requested due to automatic review settings July 14, 2026 21:50

Copilot AI 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.

Pull request overview

Removes remaining costly :has() selectors from the Automations UI.

Changes:

  • Adds per-instance chat toolbar action hiding.
  • Tracks expanded rows with an explicit class.
  • Replaces structural and focus :has() selectors.
Show a summary per file
File Description
chatInputPart.ts Adds toolbar action suppression.
aiCustomizationManagement.css Removes remaining :has() rules.
automationsListWidget.ts Toggles expanded-row styling state.
automationDialog.ts Configures hidden dialog toolbar actions.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Medium

Follow-up to #324986 / #324985, which removed the catastrophic
body:has(.automation-dialog) rules. The Automations UI still shipped four
:has() selectors in aiCustomizationManagement.css that add :has()
invalidation bookkeeping to the global stylesheet (present in Stable even
when the feature is off). This removes all of them:

- Chat-input chips (Configure Tools / Add Context / List MCP Servers) were
  hidden with .action-item:has(.action-label.codicon-*). .action-item
  is a workbench-wide anchor, so this was the one with Stable-wide reach.
  They are now hidden by targeting the .action-label codicon class
  directly. .action-item has no intrinsic box spacing, so the slot
  collapses to zero width and there is no visual gap. Known trade-off: the
  hidden chips stay in the toolbar's arrow-key focus rotation (the action
  bar skips only disabled/separator items). This is accepted for now; the
  dialog will migrate to newChatInput.ts, which never renders these
  MenuId.ChatInput chips.
- .automations-row:has(:focus-visible) -> .automations-row:focus-within,
  matching the sibling customization lists' documented focus-ring pattern.
- .automations-row-wrapper:has(> .automations-row-history) (x2) ->
  a JS-toggled .automations-row-wrapper-expanded class. The history panel
  is always in the DOM, so the old :has() matched every row; the class
  reflects the actual expanded state, which also restores hover highlight on
  collapsed rows and only flattens the card corners when expanded.

Scoped entirely to the automations CSS block; no shared components change.
Type-check, ESLint, and stylelint pass.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 21ce38e3-a711-467a-a289-8a13d1414f58

Copilot AI 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.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Medium

@tomekmarchi

Copy link
Copy Markdown

Did you notice this issue also affecting file icons in the file explorer having the same lag on scroll which could be related to this as it presented at the same time and improved in insiders with some of the fixes applied?

@benvillalobos

Copy link
Copy Markdown
Member Author

Tomek Marchi (@tomekmarchi) I did not notice that specifically, but that lines up. The fix from #324986 should have fixed that and 1.128 has since been patched

@benvillalobos
Ben Villalobos (benvillalobos) marked this pull request as ready for review July 17, 2026 17:57
@benvillalobos
Ben Villalobos (benvillalobos) merged commit e478e2d into main Jul 17, 2026
29 checks passed
@benvillalobos
Ben Villalobos (benvillalobos) deleted the bv/automation-css-audit branch July 17, 2026 19:07
@vs-code-engineering vs-code-engineering Bot added this to the 1.130.0 milestone Jul 17, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Aug 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI performance degrades after opening Hover, Command Palette, or main menu

5 participants