phetsims / build-an-atom

"Build an Atom" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/build-an-atom
GNU General Public License v3.0
11 stars 10 forks source link

fuzzBoard error with setAccessibleAttribute #194

Closed jessegreenberg closed 6 years ago

jessegreenberg commented 6 years ago
build-an-atom
Uncaught Error: Assertion failed
Error: Assertion failed
    at window.assertions.assertFunction (http://localhost:8080/assert/js/assert.js:22:13)
    at ElectronShellView.setAccessibleAttribute (http://localhost:8080/scenery/js/accessibility/Accessibility.js?bust=1538493875611:2173:21)
    at HTMLDivElement.keydown (http://localhost:8080/shred/js/view/ElectronShellView.js?bust=1538493875611:140:14)
    at triggerDOMEvent (http://localhost:8080/scenery/js/display/Display.js?bust=1538493875611:1155:41)
    at Display.fuzzBoardEvents (http://localhost:8080/scenery/js/display/Display.js?bust=1538493875611:1129:7)
    at Sim.stepSimulation (http://localhost:8080/joist/js/Sim.js?bust=1538493875611:839:22)
    at Sim.stepOneFrame (http://localhost:8080/joist/js/Sim.js?bust=1538493875611:795:14)
    at Sim.runAnimationLoop (http://localhost:8080/joist/js/Sim.js?bust=1538493875611:778:14)
build-an-atom
Uncaught Error: Assertion failed
Error: Assertion failed
    at window.assertions.assertFunction (http://localhost:8080/assert/js/assert.js:22:13)
    at ElectronShellView.setAccessibleAttribute (http://localhost:8080/scenery/js/accessibility/Accessibility.js?bust=1538493875611:2173:21)
    at HTMLDivElement.keydown (http://localhost:8080/shred/js/view/ElectronShellView.js?bust=1538493875611:140:14)
    at triggerDOMEvent (http://localhost:8080/scenery/js/display/Display.js?bust=1538493875611:1155:41)
    at Display.fuzzBoardEvents (http://localhost:8080/scenery/js/display/Display.js?bust=1538493875611:1129:7)
    at Sim.stepSimulation (http://localhost:8080/joist/js/Sim.js?bust=1538493875611:839:22)
    at Sim.stepOneFrame (http://localhost:8080/joist/js/Sim.js?bust=1538493875611:795:14)
    at Sim.runAnimationLoop (http://localhost:8080/joist/js/Sim.js?bust=1538493875611:778:14)

While testing fuzzBoard, I encountered this error in build-an-atom.

jessegreenberg commented 6 years ago

This code looks very old

  110      selectValueProperty.lazyLink( function( newValue ) {
  111        switch( newValue ) {
  112:         case ( centerOption.accessibleId ):
  113            self.setFocusHighlight( electronOuterFocusHighlight );
  114            break;
  115:         case ( innerRing.accessibleId ):
  116            self.setFocusHighlight( electronInnerFocusHighlight );
  117            break;
  118:         case ( outerRing.accessibleId ):
  119            self.setFocusHighlight( nucleusFocusHighlight );
  120            break;
  ...
  137          }
  138  
  139:         var nextElementId = optionNodes[ currentIndex ].accessibleId;
  140          self.setAccessibleAttribute( 'aria-activedescendant', nextElementId );
  141          selectValueProperty.set( nextElementId );
jessegreenberg commented 6 years ago

This code is using aria-activedescendant, which there currently isn't support for in scenery. I made https://github.com/phetsims/scenery/issues/873 to track the implementation, but since it isn't needed for anything, I am not sure we will get to this soon.

jessegreenberg commented 6 years ago

Ill remove the current usage of self.setAccessibleAttribute( 'aria-activedescendant', nextElementId );, and we need to remove the references of accessibleId. We should use a map instead that maps from active option to focus highlight.

jessegreenberg commented 6 years ago

Removing aria-activedescendant showed another problem with the way that focus highlights are updating. Ill make an issue in scenery.

jessegreenberg commented 6 years ago

This is no longer occurring with fuzzBoard.