Skip to content
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

Changing the Alpha Slider on Color Picker changes RGB values on some colors #28758

Open
Tracked by #34284
noknokcody opened this issue Feb 5, 2021 · 4 comments
Open
Tracked by #34284
Labels
[Feature] Colors Color management General Interface Parts of the UI which don't fall neatly under other labels. [Type] Bug An existing feature does not function as intended

Comments

@noknokcody
Copy link

Description

When using some RGBA colors on the color picker, adjusting the alpha slider also adjusts RGB values slightly. For example, if you enter the RGBA values 246, 110, 4, 1 on an Alpha-Enabled color picker and then adjust the Alpha slider, the Green value of "110" get's changed to "109". While the color change is minimal to the human eye, it makes it impossible to detect whether a change to the RGB values was intentional or not which is what I'm trying to detect.

Step-by-step reproduction instructions

  1. Go to https://wordpress.github.io/gutenberg/?path=/docs/components-colorpicker--alpha-enabled
  2. Change the RGBA values to 246, 110, 4, 1 (You may need to click outside the box to trigger an state update)
  3. Adjust the Alpha slider to any value

Expected behaviour

When adjusting the Alpha slider using this preset color configuration the none of the RGB values should change. Only the Alpha value

Actual behaviour

The green value changes from 110 to 109

Screenshots or screen recording (optional)

GIF

WordPress information

No Wordpress (Using github.io)

Device information

  • Device: Desktop Computer
  • Operating system: Windows 10
  • Browser: Chrome 88.0.4324.104 (Official Build) (64-bit)
@talldan talldan added [Type] Bug An existing feature does not function as intended General Interface Parts of the UI which don't fall neatly under other labels. labels Feb 5, 2021
@talldan
Copy link
Contributor

talldan commented Feb 5, 2021

Thanks for reporting this. It seems like it always changes by 1, which makes me wonder if it's a rounding issue.

@noknokcody
Copy link
Author

I thought something similar although I believe I found a few colors where the number was changing by more than 1 value. Not sure if that helps or not. Will report back if I find any more info :)

@ciampo ciampo mentioned this issue Aug 25, 2021
31 tasks
@skorasaurus skorasaurus added the [Feature] Colors Color management label Nov 30, 2021
@mirka
Copy link
Member

mirka commented Dec 2, 2021

Looks like an upstream bug in react-colorful (omgovich/react-colorful#163). I can reproduce it in this sandbox.

@t-hamano
Copy link
Contributor

t-hamano commented Jul 18, 2022

I am not sure if this is an appropriate fix, but I wrote a PR for the library.
Hopefully this PR works correctly 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Colors Color management General Interface Parts of the UI which don't fall neatly under other labels. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants