-
Notifications
You must be signed in to change notification settings - Fork 211
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
Decouple show/hide mechanism from hash when JS available #17
Comments
This would currently need a lot of rewrite of the whole JS functionality and also add more complexity that is not needed in a lot of cases. There might be plugins out there that have problems with interacting with hash-changes that don't belong to their "area of acting" but this seems to be the problem of the respective plugin rather than CSS Modal. There might also be other plugins like accordions that rely on the hash being used. One more advantage of using hashes is that it enables deeplinking to modals which can be extremely useful. So as a conclusion I don't bother too much at the moment to move away from using the hash where appropriate. Thanks anyway for raising this issue. |
I ran into a similiar problem today, b/c Sizzle did throw some weird errors. I tracked the source down to CSS-Modal. I doesn't brake the site or anything. But the error messages are kinda unpleasant. What about an additional "namespace" for the modal to solve conflicts like that. The |
@sebald Without knowing you exact problem I don't see a reason why this should result in an error. It's up to you how you name your modal's ID. If I misunderstood you, please can you elaborate on your issue? |
@anselmh I actually noticed that the version the project I am working on is older. Newser version of CSS-Modal do not use jQuery anymore, but I think it still could lead to problems with other JS. CCS-Modal and the other plugin are working toghether without disrupting one another. But what make me uncomfortable is the fact that CSS-Modal is greedy when it comes to hash changes. Meaning, for whatever reason the hash changes CSS-Modal recognizes that change and tries to find and show a modal. I find it problematic that it always tries to find/show a modal, because this could possibly lead to a conflict with other JavaScript if the CSS-Modal isn't robust enough and throws an error. I guess in 80% of the time there will be no issue, but it would be nice if you could pass the CSS-Modal an option so it "runs" in its own scope. One solution to this woul be what @Schepp suggested. Another one would be to use a prefix in the hash so that CSS-Modal only runs when the hash contains the prefix. |
My suggestion would be to decouple visibility of the modal from the hash once JS is available - reason being that this leaves the page's author with the possibility of using the hash as a means of navigation through his site (be it hashbang based or not).
This would also open ways to stack multiple modals on top of each other.
The text was updated successfully, but these errors were encountered: