craftcms / craftcms/cms

[5.x]: First color option doesn't save in Color field

Open
#17,251 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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
  1. Create a new Color field in your Craft CMS setup
  2. Configure the color field with a palette of colors and disable custom colors. No color is defined as default.
  3. Add this field to a field layout (e.g., for a category group)
  4. Edit an entry with this field
  5. Select the first color in the palette
  6. Save the entry
  7. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.