Overview
After applying the fix from #3459249, which addressed the problem of opening a context menu on right-click, a new issue has emerged related to the handling of mouse wheel events.
In the previous fix, we introduced the following code snippet to handle zooming in and out on a canvas element when a modifier key (like `Ctrl`) is pressed, and to allow for canvas scrolling when the modifier key is not pressed.
With this change, the default mouse wheel scrolling behavior is always prevented unless a modifier key is pressed. This has caused a problem when a sidebar on the left is open:
- **No Scroll on Sidebar**: When the sidebar is open and the user tries to scroll using the mouse wheel, the sidebar does not scroll. This is because the event is being captured by the `handleWheel` function and prevented from propagating to the sidebar.
Proposed resolution
User interface changes
Issue fork experience_builder-3472634
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kristen polConfirmed that the component scroll isn't working in latest code as of a couple hours ago.
https://youtu.be/j46NzjwEfp8
Comment #4
boulaffasae commentedThe above should resolve the issue.
1. Removing this code should allow default scrolling behavior
2. There was an issue with zoom in/out because the event was triggered two times - so I had to remove the 2nd call
Comment #5
kristen polI've tested this and scrolling the component list does work now.
Comment #6
kristen polI can't say if the code is okay though so we need a frontend person to review.
Comment #7
lauriiiI assume this is breaking something about interacting with the canvas because there's a test failure related to that. It's okay if you want to use this as a workaround in the meanwhile but before merging this, that would need to be investigated.
Comment #8
balintbrews@boulaffasae, thank you for opening the issue and the MR. I left you a comment there. Can you please explain what you wrote about removing that second piece?
Where did you see that the event was getting triggered twice? I didn't manage to reproduce it by adding those lines back.
Comment #9
boulaffasae commentedHi @balintbrews,
Looking at the code, modifierKeyPressedRef use modifierKeyPressed which is defined as 'ctrl' key
which mean this will be trigged when you hold ctrl, same goes for the code I removed.
It get triggered on e.ctrlKey.
The 1st one dispatch canvasViewPortZoomIn/Out, the 2nd one dispatch canvasViewPortZoomDelta
I recorded a video:
https://www.loom.com/share/ca60394e70844bb88cfe954ee4d172c3?sid=5893a489-832a-4d4b-ba22-f6e3acfe8831
Comment #10
kristen polComment #11
balintbrews@boulaffasae and I worked on this issue together via Slack, and concluded that #4.1 is the actual solution, and that the code was most likely re-introduced in #3459249: Allow opening the contextual menu by right clicking a component by a merge mistake. (It was removed in #3471102: Unable to scroll component list.) We also had to add back #4.2, but it was indeed the case that the same event was being handled in two different ways simultaneously, so we ended up removing some code for that which came from #3459249: Allow opening the contextual menu by right clicking a component, which we deemed unnecessary.
Setting the issue to RTBC, I'd like another pair of eyes on this before we merge.
Comment #12
kristen polAwesome! Thanks for the fast review... hopefully this can land soon.
Comment #13
balintbrewsIn the meantime I opened #3472687: Write end-to-end test for scrolling component insert panel.
Comment #14
wim leersComment #17
jessebaker commentedTested, and code reviewed. Merging!
Comment #18
kristen polYay!!!