Repository navigation
fix(editor): keep a cleared color field editable - #311
Merged
Merged
Conversation
anurag629
approved these changes
Oct 28, 2026
anurag629
left a comment
Member
There was a problem hiding this comment.
Thanks @prakashNalla, and nice find that CustomizePanel was the one turning an empty value into #000000. Check (0 errors), all 1553 tests and the build pass on top of dev, and in the editor clearing Background now leaves the field empty, typing #fff works and the swatch follows with #ffffff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Clearing a color's hex field turned it into
#000000.CustomizePanelpassedString(value || '#000000')toColorPicker, so the empty string the field sends when you delete everything came straight back as#000000, and withmaxLength={7}already used up, typing a new color did nothing. It now passes the value as it is (value ?? '').In
ColorPicker, the hex field shows what was typed, including empty and partial values, and only adds a#when there is something to add it to, so typing#fffinto a cleared field doesn't become##fff. The<input type="color">only takes#rrggbb, so it now gets the value throughnormalizeHexColor()and keeps the last valid color while the text is empty or partial. The preview already falls back to the template default for an empty or partial color throughnormalizeColorFields().Closes #309
How I Tested This
On
npm run dev,/create/saas, Customize, Background field:#000000, and typing#fffchanges nothing#0f172a. Typing#fffgives#fffwith the swatch at#ffffff. Selecting and typing over a value, and deleting characters from the end, work as beforeAdded
tests/editor/color-picker.test.ts: a cleared field renders empty,#fffandff8800show as typed with a#rrggbbswatch, and a partial value stays in the text field. Without the change, 2 of the 3 fail.npm run check: 0 errors, 0 warnings.npm run test: 79 files, 1543 of 1544 pass. The one failure isagenda.test.ts("renders valid SVG and PNG for 2, 3, and 4 sessions") hitting its 5000ms timeout, which this change doesn't touch; it passes 12/12 with--testTimeout=30000.npm run build: passes.AI Assistance
Claude helped me w/ understand the issue
Type of Change
Screenshots
N/A, nothing changes in the rendered images. The fix is how the editor's color field behaves, and the before and after are above.
Checklist
devnpm run checkpassesnpm run testpassesnpm run dev