Skip to content
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

Color Picker shows behind HTML dialog #116

Open
ArildoDev opened this issue Aug 2, 2024 · 4 comments
Open

Color Picker shows behind HTML dialog #116

ArildoDev opened this issue Aug 2, 2024 · 4 comments
Assignees

Comments

@ArildoDev
Copy link

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
Copy link
Author

ArildoDev commented Aug 2, 2024

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
Copy link
Owner

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.

@KroneCorylus KroneCorylus self-assigned this Aug 4, 2024
@ArildoDev
Copy link
Author

ArildoDev commented Aug 5, 2024

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
Copy link

ecancil commented Sep 9, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants