phetsims/build-an-atom

fuzzBoard error with setAccessibleAttribute

Closed this issue · 5 comments

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.

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 );

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

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.

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

This is no longer occurring with fuzzBoard.