google / blockly

The web-based visual programming editor.
https://developers.google.com/blockly/
Apache License 2.0
12.4k stars 3.7k forks source link

mouse wheel events are not being fired during a drag #8135

Open maribethb opened 4 months ago

maribethb commented 4 months ago

Check for duplicates

Description

title

this is needed for scroll-options to work

Reproduction steps

  1. Attach this event listener to the playground in core:

     Blockly.browserEvents.conditionalBind(
          workspace.getSvgGroup(),
          'wheel',
          this,
          () => {
            console.log('mouse wheel event');
          });
  2. open the console
  3. scroll the mouse wheel, observe the logs
  4. pick up a block to drag it
  5. scroll the mouse wheel, observe the lack of logs

Stack trace

No response

Screenshots

No response

Browsers

No response

maribethb commented 4 months ago

surprisingly, this css change is causing it https://github.com/google/blockly/pull/7999

maribethb commented 4 months ago

The drag layer is not a child element of the workspace.getSvgGroup() element where we were previously attaching the event listener. If the drag layer captures an event, it will be bubbled up, but the svg group won't get it because it's not a parent of that element.

Before the change in 7999, the drag layer wasn't capturing events. After that change, it does capture events (including, apparently, wheel events despite the name of the css property).

So the scroll option plugin should put its event listener directly on the drag layer.

So consider this issue to be that core should provide a getter for the drag layer. for now in scroll-options i can get the layer through query selectors.

bsampada7 commented 3 months ago

Can I work on this issue @maribethb?

BeksOmega commented 3 months ago

Can I work on this issue @maribethb?

Hiya @bsampada7 I don't think we quite know how we want this to work yet. The list of help wanted issues is probably a better place to look for things to work on! Let me know if there's something specific you're interested in and I can try to match you with an issue =)