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

Reposition function is not working with shadow roots (selector option) #111

Open
thomleclerc opened this issue Oct 25, 2022 · 0 comments
Open

Comments

@thomleclerc
Copy link

thomleclerc commented Oct 25, 2022

Actual behavior

You provide a useful feature for shadow roots which is the selector property, however the reposition function is not working due to shadow roots. You are using document.getElementsByClassName which gets blocked by the shadow roots so whenever we use shadow roots nothing get selected, so nothing is repositioned.

Expected behavior

I expect the reposition function to work in shadow root by checking if a selector is passed to the toast and using it to do the getElements located here. I have managed to make it work locally by doing the following (I haven't tested any other usecases so it may broke other usecases but it's a good track of solution) :

I have passed the this object as props to the reposition function to get access to the selector and check if any is provided, if so we do the equivalent of getElementsByClassName but with shadow roots way, which is the querySelectorAll.

We get the following for the lime 363:
var allToasts = toast.options.selector ? toast.options.selector.querySelectorAll('.toastify') : document.getElementsByClassName("toastify");

Don't hesitate if you need more information.

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

1 participant