KroneCorylus / ngx-colors

Simple yet elegant Material color picker for Angular
https:\\ngx-colors.web.app
MIT License
89 stars 25 forks source link

Color Picker shows behind HTML dialog #116

Open ArildoDev opened 4 months ago

ArildoDev commented 4 months ago

If the color picker trigger is placed in a HTML dialog, the color picker panel displays behind the modal backdrop and is not usable. Also, after closing the HTML dialog, the color picker panel persists until another action is triggered. image

ArildoDev commented 4 months ago

After some inspection, It appears that the issue stems from the fact that the HTML dialog element when displayed using the showModal() method, is displayed as a top layer. https://developer.mozilla.org/en-US/docs/Glossary/Top_layer My suggestion is to either wrap the panel in a dialog element or declare it as a popover element https://developer.mozilla.org/en-US/docs/Web/API/Popover_API

KroneCorylus commented 3 months ago

Hi @ArildoDev. You can set an ID to your dialog or any element within it, and then pass that ID to ngx-colors using the attachTo property.

ArildoDev commented 3 months ago

Hello again, I tried the suggestion as follows (the color picker is within an if statement) image image and got the following error image Also, when the trigger is clicked, the panel does not show in the correct position image (it appears way to the side) if attaching to anything inside the dialog, it will not appear at all

ecancil commented 2 months ago

@ArildoDev When is use attachTo, and attach it to something within a modal, it shows offset the same amount that the modal is offset from the top right of the screen. So while it is attached to that element in a z-index perspective, the coordinates are totally off

image