[5.x]: First color option doesn't save in Color field
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
Description
When using the Color field in Craft CMS 5.7.5, selecting the first color in the palette and saving the entry does not persist the color value. The field remains empty after save and reload. However, selecting any other color in the palette works correctly and persists after saving.
Steps to reproduce
- Create a new Color field in your Craft CMS setup
- Configure the color field with a palette of colors and disable custom colors. No color is defined as default.
- Add this field to a field layout (e.g., for a category group)
- Edit an entry with this field
- Select the first color in the palette
- Save the entry
- Reload the entry edit page
Expected behavior
The selected color (first in the palette) should be saved and displayed when the entry is reloaded, just as when selecting any other color in the palette.
Actual behavior
After saving the entry with the first color selected and reloading the page, the color field appears empty again.
Craft CMS version
5.7.5
PHP version
8.3.17
Operating system and version
Linux 5.15.167.4-microsoft-standard-WSL2
Database type and version
MySQL 8.0.40
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
- Amazon S3 2.2.2
- Blitz 5.10.5
- Campaign 3.5.11
- CKEditor 4.8.0
- Cloudflare R2 1.1.1
- Content Buddy 1.2.5
- CP Field Inspect 2.0.4
- Formie 3.0.27
- Icon Picker 3.0.4
- Imager X 5.1.3
- Imager X Power Pack 1.0.5
- Matrix Block Anchor 2.0.1
- Navigation 3.0.8
- Super Table 4.0.4
- Typogrify 5.0.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in a Craft CMS 5.7.5 Color field using a palette with custom colors disabled and no default color. Trace the first palette selection through save and reload; done means the first selected color persists and displays after reloading, consistently with other palette colors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100