Skip to content

Commit

Permalink
Revert "add data-trail-id attribute to labels for #949"
Browse files Browse the repository at this point in the history
This reverts commit 006f1f9.
  • Loading branch information
jessegreenberg committed Feb 28, 2019
1 parent 006f1f9 commit 44c8390
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 57 deletions.
8 changes: 1 addition & 7 deletions js/accessibility/AccessibilityUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ define( function( require ) {
// tabIndex=0 internally for all HTML elements, including those that should not receive focus
var DATA_FOCUSABLE = 'data-focusable';

// data attribute which contains the unique ID of a Trail that allows us to find the AccessiblePeer associated
// with a particular DOM element. This is used in several places in scenery accessibility, mostly AccessiblePeer.
var DATA_TRAIL_ID = 'data-trail-id';

// {Array.<String>} attributes that put an ID of another attribute as the value, see https://github.com/phetsims/scenery/issues/819
var ASSOCIATION_ATTRIBUTES = [ ARIA_LABELLEDBY, ARIA_DESCRIBEDBY, ARIA_ACTIVE_DESCENDANT ];

Expand Down Expand Up @@ -523,9 +519,7 @@ define( function( require ) {
// valid input types that support the "checked" property/attribute for input elements
INPUT_TYPES_THAT_SUPPORT_CHECKED: [ 'RADIO', 'CHECKBOX' ],

DOM_EVENTS: DOM_EVENTS,

DATA_TRAIL_ID: DATA_TRAIL_ID
DOM_EVENTS: DOM_EVENTS
};

scenery.register( 'AccessibilityUtil', AccessibilityUtil );
Expand Down
6 changes: 1 addition & 5 deletions js/accessibility/AccessiblePeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ define( function( require ) {

// assign an id that lets us map the DOM element to a Scenery Trail
// NOTE: dataset isn't supported by all namespaces (like MathML) so we need to use setAttribute
this.setAttributeToElement( AccessibilityUtil.DATA_TRAIL_ID, uniqueId );
this.setAttributeToElement( 'data-trail-id', uniqueId );

// create the container parent for the dom siblings
if ( options.containerTagName ) {
Expand All @@ -207,10 +207,6 @@ define( function( require ) {
if ( options.labelTagName ) {
this._labelSibling = AccessibilityUtil.createElement( options.labelTagName, false );
this._labelSibling.id = 'label-' + uniqueId;

this.setAttributeToElement( AccessibilityUtil.DATA_TRAIL_ID, uniqueId, {
elementName: AccessiblePeer.LABEL_SIBLING
} );
}

// create the description DOM element representing this instance
Expand Down
49 changes: 4 additions & 45 deletions js/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ define( require => {
target: true
};
const TARGET_SUBSTITUTE_KEY = 'targetSubstitute';
const TRAIL_ID_ATTRIBUTE_NAME = 'data-trail-id';

/**
* An input controller for a specific Display.
Expand Down Expand Up @@ -241,8 +242,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'mouseUpEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'point', type: Vector2IO },
{ name: 'event', type: DOMEventIO }
Expand All @@ -261,8 +260,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'mouseDownEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'point', type: Vector2IO },
{ name: 'event', type: DOMEventIO }
Expand All @@ -281,8 +278,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'mouseMovedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'point', type: Vector2IO },
{ name: 'event', type: DOMEventIO }
Expand All @@ -302,8 +297,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'mouseOverEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'point', type: Vector2IO },
{ name: 'event', type: DOMEventIO }
Expand All @@ -322,8 +315,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'mouseOutEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'point', type: Vector2IO },
{ name: 'event', type: DOMEventIO }
Expand All @@ -342,8 +333,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'wheelScrolledEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand All @@ -368,8 +357,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'touchStartedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand All @@ -389,8 +376,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'touchEndedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand All @@ -413,8 +398,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'touchMovedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand All @@ -437,8 +420,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'touchCanceledEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand All @@ -461,8 +442,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'penStartedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand All @@ -482,8 +461,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'penEndedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand All @@ -506,8 +483,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'penMovedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand All @@ -530,8 +505,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'penCanceledEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'id', type: NumberIO },
{ name: 'point', type: Vector2IO },
Expand Down Expand Up @@ -568,11 +541,11 @@ define( require => {
// could be serialized event for phet-io playbacks, see Input.serializeDOMEvent()
if ( event[ TARGET_SUBSTITUTE_KEY ] ) {
assert && assert( event[ TARGET_SUBSTITUTE_KEY ] instanceof Object );
return event[ TARGET_SUBSTITUTE_KEY ][ AccessibilityUtil.DATA_TRAIL_ID ];
return event[ TARGET_SUBSTITUTE_KEY ][ TRAIL_ID_ATTRIBUTE_NAME ];
}
else {
assert && assert( event.target instanceof window.Element );
return event.target.getAttribute( AccessibilityUtil.DATA_TRAIL_ID );
return event.target.getAttribute( TRAIL_ID_ATTRIBUTE_NAME );
}
};

Expand All @@ -581,8 +554,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'focusinEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand Down Expand Up @@ -616,8 +587,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'focusoutEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand Down Expand Up @@ -673,8 +642,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'clickEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand All @@ -697,8 +664,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'inputEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand All @@ -721,8 +686,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'changeEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand All @@ -745,8 +708,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'keydownEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand All @@ -769,8 +730,6 @@ define( require => {
phetioPlayback: true,
tandem: options.tandem.createTandem( 'keyupEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: window.Event } ],
phetioType: EmitterIO( [
{ name: 'event', type: DOMEventIO }
] ),
Expand Down Expand Up @@ -1925,7 +1884,7 @@ define( require => {
// we don't need much from the target, just the trail ID
if ( property === 'target' && domEventProperty !== null ) {
entries[ property ] = {};
entries[ property ][ AccessibilityUtil.DATA_TRAIL_ID ] = domEventProperty.getAttribute( AccessibilityUtil.DATA_TRAIL_ID );
entries[ property ][ TRAIL_ID_ATTRIBUTE_NAME ] = domEventProperty.getAttribute( TRAIL_ID_ATTRIBUTE_NAME );
}
else {
entries[ property ] = ( ( typeof domEventProperty === 'object' ) && ( domEventProperty !== null ) ? {} : JSON.parse( JSON.stringify( domEventProperty ) ) ); // TODO: is parse/stringify necessary?
Expand Down

0 comments on commit 44c8390

Please sign in to comment.