Blockly: Trashcan Fires Workspace Click Event

Created on 17 Jun 2020  Â·  3Comments  Â·  Source: google/blockly

Describe the bug


If you click on the trashcan to open it a workspace click event is fired. Not sure if this is the way it should work or not.

To Reproduce

  1. Turn on event logging.
  2. Delete a block.
  3. Click on the trashcan to open it.
  4. Observe the fired click event.

Expected behavior


Probably shouldn't fire an event? Although in the case of closing mutators maybe it should fire. I'm not sure.

events bug

All 3 comments

Hey, thanks for bringing this up!

Looking into this a bit more I think we are going to end up changing to a design that supports clicking on multiple elements on the workspace, including but not limited to a block, field, workspace, and trashcan. We think this will probably look like a UI event that has a ‘click’ type and would have more information on what element was clicked. This would either be in the form of the source element or a string that describes the element.

Since we try to limit this week to testing and major bug fixes we aren’t going to be including it in this release, but will implement something like the above design for next release.

Closing this issue as trashcan no longer fires workspace click event and filing new bug to track firing of event for closing trashcan flyout #4033

4306 re opens this since it was causing #4303.

We can potentially add back #4306 in the future.

The problem was with the use of bindEventWithChecks_. The call to bindEventWithChecks_ is setting the Blockly.Touch.touchIdentifier and so when someone tries to start a drag in the trashcans flyout it believes another action is already occurring and ignores the pointerdown event.

Possible Solutions:
Use bindEvent_ when we register the handler for this.blockMouseDownWhenFull_ as well as this.click.

When this is looked into the test for "Click with contents - fires trashcanOpen" should also be double checked since it does not seem to working right now.

Was this page helpful?
0 / 5 - 0 ratings