I've been able to reproduce this bug across multiple sites using different version of HS and varying sets of contrib modules.
The problem occurs when you use any HS widget on a node edit form (taxonomy or menu), and then use a file upload field (either adding a new file or removing an existing one). The entire set of theme css and js is loaded which causes quite a messed up looking edit form. This may also happen with other AJAX widgets, I haven't been able to test any others yet.
Marking this as critical because as it stands, HS is quite unusable.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 1671336-hs-admin-path-fix.patch | 835 bytes | acbramley |
Comments
Comment #1
acbramley commentedA themer I work with is debugging through this and trying to find out what is causing it, he's noted:
"When HS makes an ajax request it causes Drupal.ajaxPageState.theme to be overwritten with the front-end theme name. Then the next ajax request sends this info back, the system thinks your running the front-end theme so sends you all the css it thinks you now need but don't have"
Comment #2
acbramley commentedhttp://drupal.stackexchange.com/questions/5921/how-do-i-prevent-d7s-ajax... looks like this is a similar issue and was caused by the ajax request being outside the admin area
Comment #3
acbramley commentedAs a workaround for the time being I've implemented hook_admin_paths() to tell drupal that the HS ajax path is an admin path:
Comment #4
Georgique commented@acbramley Does ajax upload works for your file field after choosing something in HS select?
Comment #5
acbramley commented@Georgique yeah the file still gets uploaded, the issue is simply that the whole theme's css + js gets loaded, and since I'm on an admin page (i.e node/add/page) this adds the theme's css to the admin themes and causes the page to look all sorts of messed up. I'll post screenshots.
Note: You must have the node add form using the admin theme for this to occur.
Comment #6
Georgique commented@acbramley I have another problem - HS breaks my AJAX file validation and upload. But I suspect that this is just my own problem on my install, so will check on other sites and if confirmed there only then create new issue.
Comment #7
danielbeeke commented#3 works fine!
Comment #8
alexkb commented#3 works for me too, thanks heaps for posting this! I wanted to keep the HS stuff together in the same place, so put this hook into the HS module itself.
Comment #9
andregriffin commented#3 fixed it for me.
Comment #10
acbramley commented@alexkb thanks for rolling it into a patch :) Definitely makes sense to stick it in HS module if the same fix works for everyone! We need this committed...
Comment #11
wim leersExtraneous newline.
The "See …" message should be on the next line, preceded by a newline.
But … most importantly this is AFAICT the completely wrong way to fix it, this is just something completely unrelated that accidentally fixes the symptom.
The correct solution is this: http://drupal.stackexchange.com/a/38156. And if that doesn't work, there's a D7 core bug. IIRC there was something broken with D7's AJAX page state?
Comment #12
acbramley commentedHere's the patch finally, apologies for the wait, I just confirmed on a project that this fixed other issues too. I thought I could commit myself but looks like I don't have the access for it yet :P
Comment #13
darktek commentedHi, why this is not working for me? Any thoughts I already implemented both code but still my css mess up when I try to upload a file , help please
Edit: Sorry, yes this works, I gotta cleaned my Cache in Database. Thx !!!
Comment #14
stefan.r commentedDuplicate of #2378177: Admin theme not retained in AJAX requests & #2410351: Admin language & possible data loss