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 a5fe46dca..b07587bda 100644 --- a/packages/uui-color-picker/lib/uui-color-picker.element.ts +++ b/packages/uui-color-picker/lib/uui-color-picker.element.ts @@ -489,7 +489,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; @@ -498,7 +498,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'); @@ -661,28 +661,29 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { } private _renderPreviewButton() { - return html` - + return html` + ${this._renderColorPicker()} `; }