phetsims / density

"Density" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 6 forks source link

CT: Assertion failed: cannot start a drag when already userControlled #195

Closed zepumph closed 6 months ago

jessegreenberg commented 6 months ago

I started seeing this with ?fuzzBoard during https://github.com/phetsims/scenery/issues/1570. But I think it may be an issue with how Masses are reset. Here is what I am seeing:

1) MassView.focusablePath has a focus listener that calls mass.start. This sets userControlledProperty to true. The path receives focus. 2) Somehow (maybe the ResetAllButton) calls Mass.reset and sets the userControlledProperty to false. 3) Then, the MassView.focusablePath gets a blur event. There is a blur event listener that tries to call mass.endDrag. Since userControlledProperty.value has been reset, this causes the assertion.

If the order of operations with KeyboardDragListener seems wrong, let me know and I would be happy to keep looking.

zepumph commented 6 months ago

Ahh goodness, sorry that I made you investigate. This is totally on my side. I'm not really sure how this code path is occurring, but I'm thinking it is just because of how keyboard fuzzing is applying many keyboard events in the same frame. I added grace above and I cannot reproduce now. Closing