I'm customizing a few things within the Opigno LMS distribution and noticed an issue (there might be more spots) with using AJAX on the page. In Drupal, when an ajax request is called on the page, it automatically calls "Drupal.attachBehaviors()" oncomplete, which will re-attach all javascript in the "behaviors" object back to the entire page.
Drupal.behaviors.platon (platon.js)
Line 220:
$menuTrigger.click(function() {
change to
$menuTrigger.once().click(function() {
That needs to make use of once() to prevent adding multiple click handlers to the menu toggle.
https://www.drupal.org/docs/7/api/javascript-api/managing-javascript-in-...
For a test, install the flag module and add an ajax flag to w/e node page you want. Everytime you hit that link, that ajax request is fired, it adds another open/close click to the menu toggle button. So if you press the flag link 5x times, it will open and close 5x.
This is the first spot I have noticed, there might be more spots in there as the javascript needs some efficiency updates. Anyway, I didn't create a patch as there may be more areas. Let me know if I can help further and if I find more spots as I build this out, I will post up.
Comment | File | Size | Author |
---|---|---|---|
#2 | menu-toggle-ajax-issues-2849553-2.patch | 724 bytes | iLLin |
Comments
Comment #2
iLLin CreditAttribution: iLLin commentedAttached patch that addresses the login dropdown, and the sliding in/out menu on left.
Comment #3
iLLin CreditAttribution: iLLin commentedComment #5
amermod CreditAttribution: amermod at Connect-i commentedHi iLLin,
Thanks a lot for your help and for the issue found and fix.
I've added your fix to the next commit.
Again, thank you !
Best regards,
Allan
Comment #6
amermod CreditAttribution: amermod at Connect-i commented