-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Color Picker: Set initial hex value for picker (closes #20326) #20357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color Picker: Set initial hex value for picker (closes #20326) #20357
Conversation
|
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:
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 🤖 🙂 |
There was a problem hiding this 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.
...ages/core/components/multiple-color-picker-input/multiple-color-picker-item-input.element.ts
Show resolved
Hide resolved
There was a problem hiding this 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.
Prerequisites
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