When a new OffCanvas is opened, it executes Drupal.offCanvas.afterCreate to register few events and it only unregisters these event when you clicked the CLOSE button which fires
Drupal.offCanvas.beforeClose
However, in Setting Tray's Editing mode, it allows clicking thought different triggers, highlighted blocks, to edit different target element. Another new OffCanvas opens a new dialog via Ajax. It executes `openDialog` command and it replaces the current dialog contents without calling `Drupal.offCanvas.afterCreate`. It left zombie event handlers. It grows super fast (2^n + 1)!
Take handleDialogResize as an example, it called:
click: times
1 click: 1
2 click: 4
3 click: 9
4 click: 16
To test click on different blocks to open the off-canvas dialog but don't close the dialog before clicking the next block.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2902429-7.patch | 3.66 KB | GrandmaGlassesRopeMan |
| #7 | interdiff-2902429-4-7.txt | 1.28 KB | GrandmaGlassesRopeMan |
| #4 | 2902429-4.patch | 4.4 KB | GrandmaGlassesRopeMan |
| offCanvasEvents.patch | 4.42 KB | droplet |
Comments
Comment #2
droplet commentedComment #3
tedbow@droplet thanks for finding this!
I manually tested this by adding a JS breakpoint in
handleDialogResize(). I saw the behavior the @droplet was referring to and confirmed that the patch fixes the problem.Comment #4
GrandmaGlassesRopeMan- rerolled due to #2902304: Remove `scroll.off-canvas` event
Comment #5
wim leersGreat catch!
Comment #6
star-szrMinor but seems like this blank line should be kept.
Comment #7
GrandmaGlassesRopeMan#6 Yep, 👍🍕
Comment #8
webchickOk, since it looks like committer feedback was addressed, and this has remained RTBC for a few days after...
Committed and pushed to 8.5.x, cherry-picked to 8.4.x. Thanks!
Comment #11
webchickComment #12
tedbowChanging to new settings_tray.module component. @drpal thanks for script help! :)