Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
My team is seeing that, on some developer's local machines, offcanvas.js's dialog event handlers are not being called, which causes Outside In modals to open as normal dialogs.
Unfortunately, I can't provide replication steps as this is an intermittent issue and only shows up for some users. That said, I have found that binding the dialog events after the document is ready fixes this issue consistently, which seems harmless to add. I've uploaded gifs of the problem before/after the patch, if it helps.
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff.txt | 566 bytes | GrandmaGlassesRopeMan |
#12 | 2831924-12.patch | 4.32 KB | GrandmaGlassesRopeMan |
#9 | interdiff-7-9.txt | 574 bytes | tedbow |
#9 | 2831924-9.patch | 4.27 KB | tedbow |
#7 | 2831924-7.patch | 4.25 KB | tedbow |
Comments
Comment #2
tedbow@samuel.mortenson thanks for the patch!
Looks good to me
Comment #3
tim.plunkettCan't see from the patch but is this in Drupal.behaviors? That's already bound to document.ready.
If that's still not enough, we have a dedicated domready library to use
Comment #4
samuel.mortensonNo, I believe this was outside a behavior, which is likely why it was being bound early. I can either use jQuery.once to bind the event one time in a Drupal behavior, or use a different domready library. What is the dedicated library?
Comment #5
Devin Carlson CreditAttribution: Devin Carlson commentedA reroll of the original patch.
Comment #7
tedbowOk, this patch using attach behaviors.
@tim.plunkett I wasn't sure how to use the drupal specific dom ready library.
@samuel.mortenson if could test it on the local setup that was breaking that would be great.
Comment #8
samuel.mortensonIt looks like this patch is working for me, but could this event be bound multiple times if Drupal.attachBehaviors() is called multiple times? Should we use jQuery.once?
Comment #9
tedbow@samuel.mortenson yep. fixed
Comment #10
tkoleary CreditAttribution: tkoleary at Acquia commentedComment #11
droplet CreditAttribution: droplet commentedMake it more consistency if we can.
If not, can we jot a comment there to avoid another same request in the future :)
Comment #12
GrandmaGlassesRopeManSome explanation added for #11.
Comment #13
tedbowI think this makes clear why we are using the "." here and not just "offcavnas"
Comment #14
tedbowOk. RTBC. The randomness of this issue doesn't so it doesn't seem like we can add a test for it.
Comment #15
webchickAgreed that a test won't actually work in this context. Looks like @droplet's feedback was addressed.
Committed and pushed to 8.4.x and backported to 8.3.x, thanks!
Comment #17
webchickComment #20
tedbowChanging to new settings_tray.module component. @drpal thanks for script help! :)