-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Defining CSS reset within body.active_admin clobbers third party gem styles #1852
Comments
Just confirming, you tried this, right? body.active_admin {
// Mixin from Active Admin: _buttons.css.scss
a.cancel, a.clear { @include light-button }
} By that I mean, are you including the CKEditor CSS inside the |
I'm not sure what you intend with this code snippet, but if I understand correctly you're referring to the fix at the bottom of this document? I went that route, which has two drawbacks for me:
The problem with this issue is, that both AA and CKE can fix this. Which makes it no one's problem. |
Specific to your situation, this is what I meant. body.active_admin {
@import "ckeditor/application";
} Though I agree we should remove the body.active_admin body {
padding: 0;
margin: 0;
font-family: Arial, Helvetica, sans-serif;
} Which obviously wouldn't match anything. |
Hi guys, Thanks for the input. @daxter My main point for the issue is that I think using the @imb |
@daxter @pietschy In the meantime, any chance that the CSS 'fix' I referenced will go into mainline? I think it'd be a good idea regardless. |
@lmb, |
Sorry, I clicked close accidentally. |
@daxter @tinynumbers |
@imb Hence my contention that the body.active_admin is not required since the premise of the original but report #1343 was wrong. If you don't want the AA styles you shouldn't include them. Unless I'm wrong of course (c: |
I guess I'm agreeing here - and corollary to this, if you want the Active Admin styles scoped by body.active_admin, then do it yourself, but I don't believe the project itself should impose this, since wrapping everything in a body.active_admin tag gives every style in the AA stylesheets a higher precedence than any style of any third party plugins (e.g. CKEditor) that we might want to use in conjunction with AA. So ideally #1343 would be rolled back and replaced with tweaks to the CSS that allow all of the AA styles to be encapsulated by anyone who wants to do so, but does not impose this. In the meantime I'm going to be using my fork at https://github.com/tinynumbers/active_admin/tree/unencapsulate-css-global-reset until this gets resolved. Anyone else is free to do so as well. I'll be doing my best to keep it in sync with the master (other than the CSS encapsulation). |
@tinynumbers, @pcreux, @gregbell |
Thank you for that fork, @tinynumbers. That did the trick for me, and I haven't seen it affect anything else (including my custom styles and other 3rd party styles). Cheers. |
+1 to remove body.active_admin! So annoying... |
Another +1 from me, using @tinynumbers fork for now ... (thanks for providing it @tinynumbers ) |
For those using my fork to get around the body CSS encapsulation, note that I just merged in the latest changes from the main repository master branch. A number of new features in there, so be warned... |
👍 |
Why don't we just remove the body.active_admin encapsulation all together and then mention in the Readme that require_tree in application.css will cause conflict with active admin. require_tree is not good practise anyways and shouldn't be used; there is no sense including the entire active_admin js/css files into the main application js/css just for convenience of setup. |
👍 I'm using it for sometime and it works pretty well |
I ported @tinynumbers patches to rails4 branch. Should definitely avoid polluting the body tag as I struggled with ckeditor, tinymce editor, rich editor, and a few others I was trying before I realized it was Active Admin that was messing things up rather than the wysiwyg editors themselves. |
This has now been resolved on master. Everyone, sorry that it took so long to fix this. |
Excellent! This fixes the issues I was having. |
From what I can see, since #1343 AA targets it's CSS resets styles to
body.active_admin
. This is giving them higher specificity than styles included later in the asset chain.This is a big problem when using third party plugins such as https://github.com/bastiaanterhorst/rich. The the resets completely clobbering things and I have to do various ugly hacks to make things work.
A quick fix of moving the reset out of
body.active_admin
might work but I think the larger problem is that the common pattern '... is to include all css files together.' (mentioned in the pull request) isn't really going to work here.I'm not a rails expert but I would have thought it was possible to include AA specific assets on only AA pages so the
body.active_admin
selector can be dropped???The text was updated successfully, but these errors were encountered: