fix: improve SF color token indicator in Bricks editor - #38
Conversation
…x input sync
panel.css:
- Add order:10 to .bricks-control-preview and order:11 to .slashed-sf-color-btn
so both swatches appear to the right of the text input in the
[data-control="color"] flex row (scoped via :has() to only apply when our
SF button is present, leaving untouched colour controls unaffected)
- Update .slashed-sf-preview-label: change text from "SF" to "✕", colour from
white to #ff4040 — a red cross on the native Bricks swatch clearly signals
the adaptive sf-* token cannot be shown as a static hex
color-swatches.js:
- updatePreviewForSFToken: inject ✕ instead of "SF"
- injectSFButton: add an 'input' event listener (via AbortController signal)
on the raw <input> so syncSFButtonState fires immediately when the user
types or clears the colour value — the MutationObserver misses input events,
which caused the swatch to stay active after removing the var()
- Add _listenedInputs WeakSet to deduplicate listeners across reconciler passes;
reset it in destroy() so re-init starts fresh
Built: integrations/bricks/assets/editor-app/app.{js,css}
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UwM66ffs2ih5ijP86uVZS9
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe SF color active-state indicator in the Bricks editor is changed from an "SF" text label to a red "✕" overlay. Flex ordering is adjusted so the native color preview appears before the SF swatch button. A WeakSet-guarded ChangesSF Color Preview Indicator and Input Sync
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Improves the visual feedback for SF color tokens in the Bricks color control panel:
orderproperty to move the native Bricks color preview and SF swatch button to the right of the text input, improving layout consistency--sf-color-*variable is removed, complementing the existing MutationObserverType
Checklist
feat:,fix:,docs:, …)npm testpassesnpm run lintpasses (stylelint +php -l)npm run verifypasses (version metadata in sync)dist/,data/inventory.json,data/classes-hints.jsoncome fromupdate-framework/build:data)CHANGELOG.mdupdated under## [Unreleased](for user-facing changes)editor-app/admin-appsource changedNotes
The changes improve UX by making it immediately obvious when an SF color token is active and why the preview swatch may not accurately represent the final rendered color (due to adaptive light-dark() values). The input event listener ensures the indicator resets promptly when users manually edit the field.
https://claude.ai/code/session_01UwM66ffs2ih5ijP86uVZS9
Summary by CodeRabbit
Bug Fixes
Style