Open pixelzoom opened 5 years ago
This should be fixed generally by https://github.com/phetsims/sun/issues/463
I looked into doing this and felt like I had got close, but found it problematic because FireListener attaches to the pointer, and such doesn't have event.currentTarget
. Master is currently adding the listener to the Node, so we do get event.currentTarget
.
Here is the patch I was thinking of
@jonathanolson is there a way to get currentTarget from a PressListener or subtype?
I encountered this in https://github.com/phetsims/sun/issues/556, using a Scenery listener that attaches itself to the Pointer will resolve that issue. That is important so that the Pointer doesn't snag other things if it moves off of the ComboBox.
I took a look and I also don't see a way to get the currentTarget (partly because we want FireListener to fire on up). But if we cannot have a currentTarget, we could have one FireListener per ComboBoxListItemNode, like this
@zepumph what do you think?
@zepumph and I tried to do this today but couldn't finish because FireListener/PressListener responds to click
events, but we need the ComboBoxListItemNode to fire on keyup
events. Here is the patch we tried:
We would like to see PressListener optionally fire from keydown
/keyup
events instead of click
events so this kind of thing would work.
Over in https://github.com/phetsims/scenery/issues/1137, we were able to get rid of one of these TODO links (https://github.com/phetsims/sun/commit/4e6d4c7e91638ed25eecef6f7576dda13f307ed4) because you can now focus elements even when input is mouse/touch. Focus highlights will only be shown when needed for keyboard.
is there a way to get currentTarget from a PressListener or subtype?
That seems like a SceneryEvent feature, but targetNode
can also be used. Might be good to have a call if I can help!
Related to #445, in CombBoxListBox.
Sometime in the future, investigate replacing
fireEmitter
andselectionListener
with a standard scenery listener (PressListener, FireListener,...)