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

ColorPicker disabledAlpha prop does not work #43253

Closed
gregor-mueller opened this issue Jun 28, 2023 · 3 comments
Closed

ColorPicker disabledAlpha prop does not work #43253

gregor-mueller opened this issue Jun 28, 2023 · 3 comments

Comments

@gregor-mueller
Copy link

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. Have a ColorPicker with disabledAlpha.
  2. Open it

What is expected?

The slider and value box for the alpha value should not be visible

image

What is actually happening?

They are visible and can be interacted with, changing the value.

image

Environment Info
antd 5.6.3
React 18.2.0
System Mac
Browser Chrome 114

The props are typed to accept several props from the rc-color-picker but not all props are actually being relayed.

See:
https://github.com/ant-design/ant-design/blob/master/components/color-picker/ColorPicker.tsx#L29-L79

Not spreading the ...rest props might lead to other issues as well (e.g. data- attributes and others not being relayed)

@RedJue
Copy link
Member

RedJue commented Jun 28, 2023

In fact, disabledAlpha is only implemented in rc-color-picker, not in antd. We are still discussing whether we need to expose it to users in antd.

@gregor-mueller
Copy link
Author

I see. Would be a bummer for me, as I got some backends that don't support alpha values - so I would not be able to remove another library in favour of using the antd component.

Until it's decided it might be a good Idea to add it to the Omit<RcColorPickerProps, 'onChange' | 'value' | 'defaultValue' | 'panelRender' | 'disabledAlpha' > nonetheless.
Because right now, TypeScript would suggest it to anyone using the ColorPicker (that's how I found it).
Still, the issue with the data- props (and any others that are not omitted) remains. They will be accepted but not actually relayed to the actual picker (and in the end the DOM node).

@MadCcc
Copy link
Member

MadCcc commented Aug 2, 2023

Released in 5.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants