bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Modal 'windowClass' option not working anymore?

Open wasphub opened this issue 12 years ago • 10 comments

I moved fro 0.7.0 to 0.11.0, and now I do not see the value specified with option windowClass assigned as a CSS class to the modal window anymore, as it was happening with 0.7.0. The link function in the modalWindow directive is executed, and with it the addClass line, but the incoming element has a weird selector with an unresolved {{windowClass}} binding expression, which might be related to the issue.

I did not see anything about that in the change log, am I missing something or is it a bug?

Note: I solved my issue anyway playing with CSS, but if I did not miss anything and it's intentional then maybe it should have been listed as a breaking change.

wasphub avatar Jun 10 '14 08:06 wasphub

@wasphub it works as designed. Not sure if this one needs mention in the breaking changes section as your use-case is a bit "abusing" directives expressed as CSS classes (which IMO should be avoided). What you can easily do after 0.7.0, though, is to write a directive that targets the modalWindow element. https://github.com/angular-ui/bootstrap/blob/master/src/modal/modal.js#L78

pkozlowski-opensource avatar Jun 10 '14 11:06 pkozlowski-opensource

Quoting the documentation:

windowClass - additional CSS class(es) to be added to a modal window template

I cannot really see how I would be abusing such feature given its description. Don't you think there is a problem here (either in code or in documentation)?

Also, if it's working as designed now, then it was not with 0.7.0, but I could not see it as a listed bug.

Just trying to figure out how should I expect this one to evolve in future releases (it's used in a production environment).

wasphub avatar Jun 10 '14 14:06 wasphub

I think this should be reopened, or at least converted in an issue about the documentation.

wasphub avatar Jun 11 '14 10:06 wasphub

Have to agree with @wasphub about this. The previous (up to 0.10) behaviour worked excellently, and this is a definite step back in usability.

At the very least there should be more thorough documentation about how to achieve the same behaviour on 0.11.

johnsto avatar Jul 18 '14 13:07 johnsto

When I use windowClass in 0.11 I just get an attribute window-class added to the element. It isn't actually adding the class to the modal anymore. Additionally, and I hope I'm just missing something dumb, but I can't seem to do addClass from the a modalWindow directive either.

jacobmumm avatar Jul 29 '14 18:07 jacobmumm

Interesting, so I'm not the only one thinking that this is a valid issue.

wasphub avatar Jul 30 '14 16:07 wasphub

This is an issue for us as well.

isc avatar Aug 05 '14 13:08 isc

This is a valid issue. After upgrading from 0.8.0 to 0.11.0, the windowClass string that I pass to the $modal.open() method is no longer added as a window class, but is instead added as the value of a new window-class attribute. This is a regression from previous functionality, and it also goes against what the documentation says and the way it has worked all along.

gregtzar avatar Sep 13 '14 05:09 gregtzar

I am also seeing the same issue using 0.11.0 version. Adding windowClass parameter is simply adding a custom attribute with the value as the class name you want to add. I had to use custom attribute selector in css to access that to make it work. Just pointing it out as the documentation doesnt say so

jci-yarora avatar Mar 12 '15 07:03 jci-yarora

I am using 0.13.0 version and I also faced this issue. However after comparing my templates with the the this version, it seemed I had not updated the templates lately and it was because of the old templates which was causing the bug. After replacing window.html with the one in https://github.com/angular-ui/bootstrap/tree/master/template/modal, this issue was gone.

naveenraina avatar Jun 12 '15 09:06 naveenraina