diff --git a/packages/uui-color-picker/lib/uui-color-picker.element.ts b/packages/uui-color-picker/lib/uui-color-picker.element.ts index 18e51e9c5..629b8157d 100644 --- a/packages/uui-color-picker/lib/uui-color-picker.element.ts +++ b/packages/uui-color-picker/lib/uui-color-picker.element.ts @@ -107,9 +107,6 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { margin-left: 0.75rem; border-radius: 50%; } - color-picker__trigger { - cursor: pointer; - } .color-picker__preview::before, .color-picker__trigger::before { content: ''; @@ -488,7 +485,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { event.stopImmediatePropagation(); const target = event.target as HTMLElement; - const popover = target.nextElementSibling as UUIPopoverElement; + const popover = target.parentElement as UUIPopoverElement; popover.open = !popover?.open; @@ -497,7 +494,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { closeColorPicker(event: Event) { const target = event.target as UUIPopoverElement; - const trigger = target.previousElementSibling; + const trigger = target.querySelector("button[part=trigger]"); if (trigger) { trigger.setAttribute('aria-expanded', 'false'); @@ -653,27 +650,29 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { } private _renderPreviewButton() { - return html` + return html` + ${this._renderColorPicker()} `; }