Skip to content

Conversation

@bjarnef
Copy link
Contributor

@bjarnef bjarnef commented Oct 2, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes #20326

Description

This issue was it set hex value without # in hidden <input type="color" /> - it need to be a hex color with # and 6-digits (3-digits doesn't work to set initial color picker value). The value is still stored as in previous format without #.

Initially most browsers probably set black as default color, so without change color via click, drag or input it doesn't trigger change event, but it's okay although a bit annoying when one wants to select black initially 😅

I also expanded the hex from 3-digits to 6-digits in the local variable, so it works for e.g. #555.

chrome_5olSkQgR3p.mp4

Copilot AI review requested due to automatic review settings October 2, 2025 20:47
@github-actions
Copy link

github-actions bot commented Oct 2, 2025

Hi there @bjarnef, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@bjarnef bjarnef changed the title Set intial color for hidden color input Set initial color for hidden color input Oct 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where the hidden color input was not using a valid hex color format, causing browsers to not trigger change events properly. The change ensures the color input receives a properly formatted hex value with the # prefix.

@bjarnef bjarnef changed the title Set initial color for hidden color input Color Picker: Set initial hex value for picker Oct 2, 2025
Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thanks @bjarnef - I've tested out locally and see it working correctly now, for 3 and 6 digit colour values.

@AndyButland AndyButland merged commit 36dbab2 into umbraco:main Oct 3, 2025
27 checks passed
@AndyButland AndyButland changed the title Color Picker: Set initial hex value for picker Color Picker: Set initial hex value for picker (closes #20326) Oct 3, 2025
@bjarnef bjarnef deleted the v16/bugfix/20326-color-picker-initial-value branch October 3, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Color picker doesn't set initial color in prevalues

2 participants