-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Ionic 2 Alert Bug: setCssClass overrides existing css classes #6835
Comments
Hello, thanks for opening an issue with us! Would you be able to provide a plunker that demonstrates this issue? Thanks for using Ionic! |
Thank you for your interest. I think in this context it makes more sense to have a look at the current implementation of the method setCssClass in Alert which is supposed to add a cssClass but it really sets it instead of adding: 257 /** |
This seems to be fixed by: 215c6d8. |
So what I'm seeing with the latest is:
This creates an alert with the classes: and if I call the function to set the class like this:
then the following classes are added: I think this function is doing what it should, but maybe you are asking for a function that just adds classes @ch-weiss? |
@brandyscarney: Thank you for the explanation. The problem I identified is in the context of selections. Selections offer the possibility to specify a css class parameter which is passed on to the generated alert. I did this but in the dom I did not find the specified css class. So I debugged what happens and found that during alert generation the css class is passed on to the alert. Then the standard alert classes of Ionic are set using the method setCssClass of alert. This setting overrides the css class that came from the selection. When I change the implementation of the method setCssClass to add the css class parameter given to it instead of setting it all works fine and the csss class parameter that comes from the selection is in the dom as well as Ionics standard css class for alerts |
@ch-weiss Thanks for the description! I'm able to see the problem using selects. |
This will be fixed in the |
@brandyscarney Thanks for your attention and to the whole team for the awesome work! |
Short description of the problem:
The Alert method setCssClass does not add a cssClass as documented but sets it and overrides existing css classes that have beeen set while creating the Alert (or that have been passed on by Selections)
What behavior are you expecting?
The method works as documented and adds cssClasses without overriding existing ones. Maybe the name of the method should be changed to addCssClass to make things more clear.
Steps to reproduce:
Which Ionic Version? 2.x
The text was updated successfully, but these errors were encountered: