-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leverage PressListener for accessibility #831
Comments
Sounds like something that would be good to discuss over voice. When would work best to discuss? (I noticed I'll need to be out for part of core hours tomorrow, but otherwise I'm pretty open). |
We discussed this today with @jonathanolson. We agreed that it would be nice if PressListener could be used more broadly for accessibility. This would reduce a lot of code that currently exists to call listeners from pointer events and call listeners from accessibility events, which are totally separated at the moment. We talked about a couple of options: One option would be to add a public Another option would be to simply add Going with this strategy, we could still use a timeout to update the state of the button and its visual representation, which is contradictory to phetsims/sun#371. We feel more comfortable about this because the logic for accessibility will be in the same type as PressListener so there will be more control over the state of its Properties. |
If we decide to continue with a timeout solution, the implementation of click in PressListener might look something like // requires Accessibility.addAccessibleInputListener to weed out things that are not DOM events
click: function() {
var event = Input.createAccessibleEvent( ...boundsInformation... );
this.press( event, syntheticPointer, ... );
Timer.setTimeout( function( {
self.release()
}, delay );
}, |
We found the option |
If you’re leveraging PressListener for a11y… Beware that PressListener has problems that are currently blocking at least 2 sims. phetsims/ph-scale#71 |
@jessegreenberg @mbarlow12 and @zepumph worked on this today. In the above commits we added From here we just need to get |
After this step, we will touch base with @jonathanolson again. |
This part was done in the above commit. The tricky part was getting it to work with ButtonModel and its current ability to have more than one listener. We ended up with using a multilink that observes all of the looksPressedProperty's of all PressListeners that may have been created.
The multilink solution mentioned above replaced the listenersToRemoveOnDispose, and is being disposed instead, so this part was also covered.
We should look into this, it would be an improvement. But the weirdness described isn't happening, probably because a second click still can't initiate because of the check in canClick. Right now a user can only click at the interval of fireOnHoldInterval. |
Handled in the above commit. Now fireOnHoldInterval is no longer an accurate name. It is purely for the a11yClickingProperty/looksPressedPRoperty now so we should change its name, and not use the option in ButtonModel. |
We added fireOnHoldInterval to ButtonModel for this, and I think it can be removed now. |
I think the above commits finish this. @zepumph could you please review 7df5663, cda0945, and phetsims/sun@38c10e6? |
We addressed the comments in #831 (comment), @zepumph reviewed the above commits. @jonathanolson can you please do another review of the commits since #831 (comment)? |
The above commits look great, thanks! |
Thanks! |
Motivated by #719, we were hoping to leverage PressListener for accessibility input.
One problem that we are facing now is that
a11yClick
in sun/ButtonModel is manipulating the Properties that are passed toPressListener
, so accessibility input and pointer input are not able to work well together. But other problems are likely to come up because the two input systems are so separate. Specifically, we are running into problems with this order of operations:For instance, we were wondering about doing something like this, where a DOM click event could leverage PressListener:
In addition to consolidation, another benefit of moving to PressListener is that we could handle interupt more easily.
As a workaround, we have found that if we return immediately on
PressListener.release()
if a pointer is not defined (because the press was triggered by an accessibility event) then we can avoid the problem.@jonathanolson do you have any insights on whether it is OK to add this workaround to
PressListener.release
, and whether leveragingPressListener
for accessibility as described above seems OK? @zepumph and @jessegreenberg would be happy do discuss more over voice if that is best.The text was updated successfully, but these errors were encountered: