Skip to content

add new check on alpha to check if undefined #1061

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

Open
wants to merge 4 commits into
base: v1/contrib
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/uui-color-picker/lib/uui-color-picker.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
this.hue = h;
this.saturation = s;
this.lightness = l;
this.alpha = this.opacity ? a * 100 : 100;
this.alpha = this.opacity != undefined ? a * 100 : 100;
Copy link
Contributor

@bjarnef bjarnef Apr 7, 2025

Choose a reason for hiding this comment

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

Not sure how opacity can be undefined? It's a boolean property with false as default value.

In the story it set value: undefined.

I guess it is more likely a from parsed color which is undefined or null, if value property is defined/null.


const hslaColor = colorString as HslaColor;

Expand All @@ -395,7 +395,6 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
this.dispatchEvent(
new UUIColorPickerChangeEvent(UUIColorPickerChangeEvent.CHANGE),
);

return true;
}

Expand Down
1 change: 1 addition & 0 deletions packages/uui-color-picker/lib/uui-color-picker.story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const Inline: Story = {
export const Opacity: Story = {
args: {
opacity: true,
value: undefined,
inline: true,
},
};
Expand Down
Loading