Skip to content
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

address REVIEW comments in a11y code #930

Closed
pixelzoom opened this issue Jan 22, 2019 · 4 comments
Closed

address REVIEW comments in a11y code #930

pixelzoom opened this issue Jan 22, 2019 · 4 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Jan 22, 2019

I stumble across multiple "REVIEW" comments in Accessibility.js, see below.

"REVIEW" comments are supposed to be used for a code review, and fully removed (or replaced with a TODO and associated issue) when the code review is completed.

        setAccessibleHeadingBehavior: function( accessibleHeadingBehavior ) {
          assert && A11yBehaviorFunctionDef.validateA11yBehaviorFunctionDef( accessibleHeadingBehavior );

          // REVIEW: Note that this doesn't seem to trigger updating the heading levels of siblings correctly:
          // REVIEW: For example, do the following:
          // REVIEW:   var a = new scenery.Node();
          // REVIEW:   var b = new scenery.Node();
          // REVIEW:   scene.addChild( a );
          // REVIEW:   a.addChild( b );
          // REVIEW:   b.accessibleHeading = 'B';
          // REVIEW:   b.tagName = 'p';
          // REVIEW:   a.accessibleHeading = 'A';
          // REVIEW:   a.tagName = 'p';
          // REVIEW: You will end up with two nested H1s. Presumably this should cascade properly and update the child
          // REVIEW: to a H2 in this case.
        computeHeadingLevel: function() {
          // REVIEW: I'd recommend looking at how node handles this with things. Usually it has an invalidate pattern
          // REVIEW: but in this case, it may be easier to just update the entire subtree whenever an ancestor changes.
        setLabelContent: function( label ) {
          assert && assert( label === null || typeof label === 'string', 'label must be null or string' );

          // REVIEW: It's also concerning that setting this ends up changing another field (especially when it's set to
          // REVIEW: the same value!). Can't we handle some of this in the with an accessible*Behavior pattern?
          // REVIEW: It seems setting and unsetting the labelContent (from null to something to null) makes permanent
          // REVIEW: changes to the labelTagName, which is weird.
          // REVIEW: Can we just have a behavior that does this instead?
          // ZEPUMPH: perhaps worked on as part of https://github.com/phetsims/scenery/issues/867

          // REVIEW: Also this is really weird:
          // REVIEW:   var n = new scenery.Node();
          // REVIEW:   n.labelTagName; // null
          // REVIEW:   n.labelContent = n.labelContent;
          // REVIEW:   n.labelTagName; // "P" !!!
        setDescriptionContent: function( descriptionContent ) {
          assert && assert( descriptionContent === null || typeof descriptionContent === 'string', 'description must be null or string' );

          if ( this._descriptionContent !== descriptionContent ) {
            this._descriptionContent = descriptionContent;

            // REVIEW: See notes in setLabelContent. Setting the descriptionTagName feels wrong,
            // REVIEW: where a behavior would be better.
            this.trigger( 'focusHighlightChanged' );
            // REVIEW: Should it call onAccessibleContentChange()
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jan 22, 2019

In the previous commit, I added TODO comments that reference this issue. If these REVIEW comments should be broken out into their own GitHub issue(s), please do so.

@pixelzoom
Copy link
Contributor Author

Same problem in A11yBehaviorFunctionDef and AccessiblePeer. Altogether, I see 132 occurrences of "REVIEW" in scenery that are related to a11y. Please replace these with TODO comments and associated GitHub issues.

@pixelzoom pixelzoom changed the title address REVIEW comments in Accessibility.js address REVIEW comments in a11y code Jan 22, 2019
@zepumph
Copy link
Member

zepumph commented Jan 22, 2019

Agreed! Related issues:

#867
#832

@zepumph
Copy link
Member

zepumph commented Feb 25, 2019

Removed and moved comments to #867 (comment). Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants