Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

TypeError: null is not an object (evaluating 'axs.properties.findTextAlternatives(a, {}).trim') #183

Closed
kennyw12 opened this issue Jul 15, 2015 · 3 comments

Comments

@kennyw12
Copy link
Contributor

There is a strange error that is thrown when running the CLI against a page that contains:

<!-- Button trigger modal -->
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal">
  Launch modal
</button>

<!-- Modal Basic -->
<div class="modal fade modal-basic" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-lowlight" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

The error that is thrown is:

TypeError: null is not an object (evaluating 'axs.properties.findTextAlternatives(a, {}).trim')

  ../../dist/js/axs_testing.js:1868 in relevantElementMatcher
  ../../dist/js/axs_testing.js:1530 in collectMatchingElements
  ../../dist/js/axs_testing.js:1553 in collectMatchingElements
  ../../dist/js/axs_testing.js:1553 in collectMatchingElements
  ../../dist/js/axs_testing.js:1553 in collectMatchingElements
  ../../dist/js/axs_testing.js:1553 in collectMatchingElements
  ../../dist/js/axs_testing.js:1553 in collectMatchingElements
  ../../dist/js/axs_testing.js:1560 in run
  ../../dist/js/axs_testing.js:1708 in run
  phantomjs://webpage.evaluate():2
  phantomjs://webpage.evaluate():4
null

We've tried poking around at the source of this issue by removing and changing the tabindex property in .modal-basic. Removing tabindex, or changing it to a positive value allows CLI to run properly.

cc/ @gpleiss, @matt-royal, @stubbornella, @ctaymor

@geekdave
Copy link

I'm seeing this as well. Reproducible easily using the downstream a11y project:

$ a11y http://www.walmart.com --verbose
Command failed: TypeError: 'null' is not an object (evaluating 'axs.properties.findTextAlternatives(a, {}).trim')
→ node_modules/accessibility-developer-tools/dist/js/axs_testing.js on line 1868

@ricksbrown
Copy link
Collaborator

This is a closure compiler bug - I have put details in the PR comments.

I think this highlights the need to run our unit tests against the built/compiled artefact before release.
I could raise another issue / PR for that - could be part of the dist target.

Of course in this particular instance none of the tests would have failed but it's still a good idea. Minification issues are rare, particularly with something as mature and expertly designed as closure compiler but they do happen.

ricksbrown added a commit that referenced this issue Jul 25, 2015
Fixes issue #183
Updated changelog and addressed nit.
@ricksbrown
Copy link
Collaborator

Closed by PR #188

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

No branches or pull requests

3 participants