Skip to content

Commit

Permalink
Factored out component property link and added to ComboBox, see #405
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Nov 14, 2018
1 parent 08e9edb commit c7d4466
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 1 addition & 11 deletions js/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ define( function( require ) {
phetioEventType: 'user',
phetioReadOnly: PhetioObject.DEFAULT_OPTIONS.phetioReadOnly, // to support properly passing this to children, see https://github.com/phetsims/tandem/issues/60
phetioDocumentation: '', // different default than PhetioObject, see implementation below
phetioControlledProperty: property,

// a11y
tagName: 'input',
Expand Down Expand Up @@ -90,13 +91,6 @@ define( function( require ) {
phetioDocumentation: 'When disabled, the checkbox is grayed out and cannot be pressed.'
} );

// (phet-io) document the instrumented Property that this Checkbox manipulates
options.phetioDocumentation +=
' This checkbox controls the PropertyIO.<BooleanIO>: ' +
'<a href="#' + phetio.PhetioIDUtils.getDOMElementID( property.tandem.phetioID ) + '">' + property.tandem.phetioID + '</a>';
options.phetioDocumentation = options.phetioDocumentation.trim(); // eliminate preceding whitespace, if any.


// @private - sends out notifications when the checkbox is toggled.
var toggledEmitter = new Emitter( {
tandem: options.tandem.createTandem( 'toggledEmitter' ),
Expand Down Expand Up @@ -181,10 +175,6 @@ define( function( require ) {

// assert that phet-io is set up correctly after the PhetioObject has been properly initialized (after mutate)

// If either one is instrumented, then the other must be too.
assert && Tandem.validationEnabled() && assert( this.isPhetioInstrumented() === property.isPhetioInstrumented(),
'Property must be instrumented if controlling Checkbox is.' );

// If either one is instrumented, then the other must be too.
assert && Tandem.validationEnabled() && assert( this.enabledProperty.isPhetioInstrumented() === this.isPhetioInstrumented(), 'provided enabled property must be instrumented for phet-io.' );

Expand Down
4 changes: 3 additions & 1 deletion js/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ define( require => {
tandem: Tandem.required,
phetioType: ComboBoxIO,
phetioEventType: 'user',
phetioDocumentation: '', // different default than PhetioObject, see implementation below
phetioControlledProperty: property,

// a11y
a11yButtonLabel: '' // {string} accessible label for the button that opens this combobox
Expand Down Expand Up @@ -273,7 +275,7 @@ define( require => {
this.buttonNode = new ButtonNode( new ComboBoxItemNode( items[ 0 ], itemWidth, itemHeight, options.itemXMargin ), options );
this.addChild( this.buttonNode );

// a11y - the list is labelledby the button's label
// a11y - the list is labeled by the button's label
this.listNode.addAriaLabelledbyAssociation( {
otherNode: this.buttonNode,
otherElementName: AccessiblePeer.LABEL_SIBLING,
Expand Down

0 comments on commit c7d4466

Please sign in to comment.