From 3a2c60886f6655756015c93bbe4e4fd50df2c880 Mon Sep 17 00:00:00 2001 From: zepumph Date: Fri, 24 Aug 2018 12:07:18 -0800 Subject: [PATCH] remove duplcated accessibleInputListeners from children, https://github.com/phetsims/scenery/issues/831 --- js/buttons/RoundStickyToggleButton.js | 11 ----------- js/buttons/RoundToggleButton.js | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/js/buttons/RoundStickyToggleButton.js b/js/buttons/RoundStickyToggleButton.js index b908ad22..d777b741 100644 --- a/js/buttons/RoundStickyToggleButton.js +++ b/js/buttons/RoundStickyToggleButton.js @@ -29,8 +29,6 @@ define( function( require ) { */ function RoundStickyToggleButton( valueUp, valueDown, property, options ) { - var self = this; - options = _.extend( { tandem: Tandem.required, phetioType: ToggleButtonIO, @@ -44,21 +42,12 @@ define( function( require ) { // Note it shares a tandem with this, so the emitter will be instrumented as a child of the button this.toggleButtonModel = new StickyToggleButtonModel( valueUp, valueDown, property, options ); RoundButtonView.call( this, this.toggleButtonModel, new StickyToggleButtonInteractionStateProperty( this.toggleButtonModel ), options ); - - // @private (a11y) - toggle the button when we receive the accessible click event - this.accessibleClickListener = { - click: function( event ) { - self.toggleButtonModel.toggle(); - } - }; - this.addAccessibleInputListener( this.accessibleClickListener ); } sun.register( 'RoundStickyToggleButton', RoundStickyToggleButton ); return inherit( RoundButtonView, RoundStickyToggleButton, { dispose: function() { - this.removeAccessibleInputListener( this.accessibleClickListener ); this.toggleButtonModel.dispose(); //TODO this fails with assertions enabled, see sun#212 RoundButtonView.prototype.dispose.call( this ); } diff --git a/js/buttons/RoundToggleButton.js b/js/buttons/RoundToggleButton.js index f21fc1f9..6d17c970 100644 --- a/js/buttons/RoundToggleButton.js +++ b/js/buttons/RoundToggleButton.js @@ -27,8 +27,6 @@ define( function( require ) { */ function RoundToggleButton( valueOff, valueOn, property, options ) { - var self = this; - // Tandem support options = _.extend( { tandem: Tandem.required, @@ -43,14 +41,6 @@ define( function( require ) { this.toggleButtonModel = new ToggleButtonModel( valueOff, valueOn, property, options ); RoundButtonView.call( this, this.toggleButtonModel, new ToggleButtonInteractionStateProperty( this.toggleButtonModel ), options ); - - // @private (a11y) - toggle the button when we receive the accessible click event - this.accessibleClickListener = { - click: function( event ) { - self.toggleButtonModel.toggle(); - } - }; - this.addAccessibleInputListener( this.accessibleClickListener ); } sun.register( 'RoundToggleButton', RoundToggleButton ); @@ -59,7 +49,6 @@ define( function( require ) { // @public dispose: function() { - this.removeAccessibleInputListener( this.accessibleClickListener ); this.toggleButtonModel.dispose(); // TODO this fails with assertions enabled, see sun#212 RoundButtonView.prototype.dispose.call( this ); }