Skip to content

refactor(ui): inline stroke attributes via shared strokeIcon shell - #113952

Merged
steipete merged 1 commit into
mainfrom
steipete/icon-inline-stroke-attrs
Jul 26, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/icon-inline-stroke-attrs

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Shared Lucide icon templates in ui/src/components/icons.ts / icons-tools.ts carried no SVG stroke presentation attributes — they relied entirely on global stylesheet rules (fill: none; stroke: currentColor; ...). Any icon rendered inside a shadow-DOM Lit component silently painted nothing, because global CSS cannot pierce shadow roots. That bug class already bit twice: the image lightbox close button (#113913) and file-preview-modal.ts, each patched with component-local CSS.

Why This Change Was Made

Real Lucide SVGs ship fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" inline; the repo's copies had stripped them. This PR restores those defaults once, via a shared strokeIcon() shell in icons-tools.ts that wraps every 24x24 icon body. Icon bodies use Lit's svg template tag (an html fragment would parse the shapes outside the SVG namespace and render nothing — verified live during development). CSS rules override presentation attributes, so every existing surface that sets its own stroke width (e.g. 1.5/1.8px contexts) keeps winning exactly as before.

The multicolor lobster art icon (120x120 viewBox, gradient fills) intentionally stays outside the shell.

User Impact

No visual change on light-DOM surfaces (verified by before/after screenshots). Icons are now self-contained: any future shadow-DOM component gets visible icons without needing to know about global stylesheet coupling — the invisible-icon bug class is gone. Net −360 LOC.

Home (before) Home (after)
before after

Shadow-DOM lightbox still correct: lightbox

Evidence

  • Before/after screenshots via pnpm dev:ui:mock + Playwright; icon rendering verified identical (only dynamic mock content differs), and DOM inspection confirmed paths render as proper SVG-namespace siblings with the new attributes.
  • node scripts/run-vitest.mjs ui/src/pages/chat/chat-composer.test.ts ui/src/components/image-lightbox.test.ts — 35/35 pass.
  • oxlint + oxfmt clean on both files.
  • Codex autoreview (gpt-5.6-sol, xhigh): clean — "patch is correct (0.96)".
  • Blacksmith Testbox backend timed out during check-changed classification; typecheck/lint fan-out is proven by hosted PR CI instead.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Jul 26, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 26, 2026
@clawsweeper

clawsweeper Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 25, 2026, 9:54 PM ET / July 26, 2026, 01:54 UTC.

ClawSweeper review

What this changes

This PR wraps the Control UI’s standard 24×24 line-icon bodies in a shared SVG shell that supplies Lucide-compatible inline stroke presentation attributes.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for the protected maintainer review: it is a coherent, source-centralized fix for the shadow-root invisible-icon class, with direct visual proof and no concrete patch defect found. The remaining decision is whether to adopt the shared presentation-default contract across the full Control UI icon catalog.

Priority: P3
Reviewed head: cd9412770de6bc257bf1ffafc10f10b6ec9a8141
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong directly relevant visual proof and a focused canonical refactor support a good merge candidate, with catalog-wide styling compatibility still requiring maintainer sign-off.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The PR includes directly relevant before/after UI screenshots and a shadow-DOM lightbox result, and the supplied CI context records successful real-behavior proof; posted media contains no evident sensitive runtime details.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR includes directly relevant before/after UI screenshots and a shadow-DOM lightbox result, and the supplied CI context records successful real-behavior proof; posted media contains no evident sensitive runtime details.
Evidence reviewed 4 items Central icon contract: The proposed shared shell supplies fill, currentColor stroke, width, linecap, and linejoin once around the reusable 24×24 icon bodies; both icon catalogs route their line icons through that contract.
Related shipped symptom: The prior lightbox close-icon repair documents the same shadow-root/global-CSS boundary and was merged, so this PR addresses an observed class of issue rather than inventing a parallel rendering model.
Real behavior evidence: The PR body provides before/after light-DOM screenshots and a shadow-DOM lightbox screenshot; the supplied review context records the real-behavior proof check as successful and labels the proof sufficient.
Findings None None.
Security None None.

How this fits together

Control UI components consume reusable Lit SVG templates from the shared icon catalog. Those templates flow into both ordinary light-DOM pages and Lit shadow-root components, where inline SVG presentation defaults avoid reliance on global CSS that cannot cross the shadow boundary.

flowchart LR
  A[Control UI component] --> B[Shared icon catalog]
  B --> C[Shared SVG stroke shell]
  C --> D[Inline Lucide presentation defaults]
  D --> E[Light-DOM UI]
  D --> F[Lit shadow-root component]
  E --> G[Visible line icons]
  F --> G
Loading

Decision needed

Question Recommendation
Should OpenClaw make inline Lucide stroke defaults the canonical presentation contract for all standard Control UI line icons after reviewing representative custom-styled and shadow-root surfaces? Adopt the shared shell: Refresh the branch and merge after a maintainer confirms representative light-DOM overrides and the image-lightbox shadow-root rendering remain intentional.

Why: This is an intentional catalog-wide rendering-contract change rather than a narrow local bug fix; source and screenshots support it, but maintainers must choose the long-term default for existing custom styling.

Before merge

  • Resolve merge risk (P1) - The shared shell changes default SVG presentation attributes for the full standard line-icon catalog; a custom-styled surface that implicitly depended on absent defaults could change appearance unless its CSS override is confirmed to retain precedence.
  • Resolve merge risk (P1) - The branch is behind current main, so the maintainer review should occur on a refreshed merge result rather than rely only on the earlier base.
Agent review details

Security

None.

PR surface

Source -360. Total -360 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 422 782 -360
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 422 782 -360

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Confirm the shared presentation contract (recommended)
    Refresh against current main and visually verify representative CSS-overridden icons plus the shadow-root lightbox before accepting the catalog-wide default attributes.
  2. Pause the catalog-wide change
    Keep the existing localized shadow-root styling if maintainers do not want standard icon templates to define default stroke presentation.

Technical review

Best possible solution:

Adopt one shared inline Lucide-style shell after a maintainer verifies representative light-DOM overrides and the shadow-DOM lightbox on the refreshed head, while retaining deliberately non-line artwork outside that shell.

Do we have a high-confidence way to reproduce the issue?

Yes, the failure class is source-reproducible: open SVG paths without inline stroke defaults depend on global CSS, which does not enter Lit shadow roots. The supplied screenshots also show the intended after-fix result, though this review did not independently run the UI.

Is this the best way to solve the issue?

Yes, conditionally: a single shared shell is more maintainable than repeating component-local shadow-root CSS, provided maintainers accept inline presentation defaults as the catalog contract and verify existing CSS overrides on a refreshed merge result.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2bffce62daac.

Labels

Label justifications:

  • P3: This is a low-urgency Control UI rendering hardening refactor with a proven localized symptom but no reported current broad outage.
  • merge-risk: 🚨 compatibility: The PR changes the default SVG presentation attributes inherited by every standard line-icon template, so existing CSS-dependent visual overrides need maintainers’ confirmation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR includes directly relevant before/after UI screenshots and a shadow-DOM lightbox result, and the supplied CI context records successful real-behavior proof; posted media contains no evident sensitive runtime details.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR includes directly relevant before/after UI screenshots and a shadow-DOM lightbox result, and the supplied CI context records successful real-behavior proof; posted media contains no evident sensitive runtime details.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR includes directly relevant before/after UI screenshots and a shadow-DOM lightbox result, and the supplied CI context records successful real-behavior proof; posted media contains no evident sensitive runtime details.

Evidence

What I checked:

  • Central icon contract: The proposed shared shell supplies fill, currentColor stroke, width, linecap, and linejoin once around the reusable 24×24 icon bodies; both icon catalogs route their line icons through that contract. (ui/src/components/icons-tools.ts:7, cd9412770de6)
  • Related shipped symptom: The prior lightbox close-icon repair documents the same shadow-root/global-CSS boundary and was merged, so this PR addresses an observed class of issue rather than inventing a parallel rendering model. (ui/src/components/image-lightbox.ts, 34ee065bf38e)
  • Real behavior evidence: The PR body provides before/after light-DOM screenshots and a shadow-DOM lightbox screenshot; the supplied review context records the real-behavior proof check as successful and labels the proof sufficient. (cd9412770de6)
  • Continuity check: The preceding ClawSweeper cycle reported no code findings and requested maintainer confirmation of representative light-DOM and shadow-DOM appearance; the current review finds no new line-level defect requiring a contributor repair. (cd9412770de6)

Likely related people:

  • steipete: Authored the merged lightbox icon repair for the same shadow-DOM rendering boundary and the current shared-icon consolidation. (role: recent area contributor; confidence: high; commits: 34ee065bf38e, cd9412770de6; files: ui/src/components/icons-tools.ts, ui/src/components/icons.ts, ui/src/components/image-lightbox.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and visually confirm one CSS-overridden light-DOM icon plus the shadow-root lightbox before merging.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-26T01:04:26.850Z sha cd94127 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review July 26, 2026 01:50
@steipete
steipete merged commit 98542bc into main Jul 26, 2026
199 of 210 checks passed
@steipete
steipete deleted the steipete/icon-inline-stroke-attrs branch July 26, 2026 02:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant