Skip to content

fix(uui-color-picker): sets preview color of empty value to transparent #1151

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 3 commits into
base: main
Choose a base branch
from

Conversation

leekelleher
Copy link
Member

Description

In the UUI Color Picker component, sets the preview colour of an empty value to transparent.

In PR #1061, the change set the alpha to 100 for undefined values, this meant that all empty values would now appear as black (#000000), but the value would remain as empty.

Prior to this change, the initial preview colour for empty values was transparent. This PR updates the preview colour accordingly.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

How to test?

In the storybook for the Color Picker component, view the Empty story, notice that the button has a transparent background colour.

@Copilot Copilot AI review requested due to automatic review settings July 14, 2025 15:01
@leekelleher leekelleher added the bug Something isn't working label Jul 14, 2025
Copy link

Copy link
Contributor

@Copilot 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 restores transparent preview for empty color values and refines slider precision behavior.

  • Ensures empty color picker values render as transparent rather than defaulting to black
  • Adds precision to H, S, L sliders and updates template bindings to use ifDefined
  • Explicitly annotates the value property type on the slider element

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/uui-color-slider/lib/uui-color-slider.story.ts Added precision settings for sliders and updated bindings to use ifDefined for color/precision
packages/uui-color-slider/lib/uui-color-slider.element.ts Specified { type: Number } for the value property
packages/uui-color-picker/lib/uui-color-picker.story.ts Adjusted story value args to demonstrate transparent preview for empty states
packages/uui-color-picker/lib/uui-color-picker.element.ts Introduced previewColor variable to render transparent background when value is empty
Comments suppressed due to low confidence (2)

packages/uui-color-slider/lib/uui-color-slider.story.ts:198

  • The ifDefined directive is used here but there's no import for it; please import ifDefined from 'lit-html/directives/if-defined.js' (or the appropriate package) to prevent runtime errors.
              color=${ifDefined(

packages/uui-color-picker/lib/uui-color-picker.story.ts:95

  • The Opacity story now sets value to swatchesTransparent[8] instead of undefined, so it no longer shows the empty state; consider reverting to undefined to demonstrate the transparent preview as intended.
    value: swatchesTransparent[8],

Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1151.westeurope.azurestaticapps.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant