Skip to content

PushButton context response occurs before listeners are called. #957

@pixelzoom

Description

@pixelzoom

This problem was noted in Vector Addition with a push button. The context response is occurring before listeners are called.

In PushButtonModel:

else if ( fire ) {

  // Produce sound before firing, in case firing causes the disposal of this PushButtonModel
  this.fireCompleteEmitter.emit();
  this.fire();
}

The order is wrong here -- listeners are notified that fire is complete before it has been called. And fireCompleteEmitter is used to queue a button's context response. In ButtonNode:

    const speakResponseListener = () => {
      this.addAccessibleResponse( this.accessibleContextResponse );
...
    };
    this.buttonModel.fireCompleteEmitter.addListener( speakResponseListener );

So what we are seeing in Vector Addition is that the context response is occuring before the listener is called. And we're never hearing the context response because it is interrupted by responses that occur in the listener.

It looks like this problem started in ca56f17 where it was added as a workaround specific to sound. Then in 869faa9, @jessegreenberg generalized to fireCompleteEmitter.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions