@@ -75,7 +75,6 @@ class Renderer2D extends Renderer {
7575    } 
7676    // Set and return p5.Element 
7777    this . wrappedElt  =  new  Element ( this . elt ,  this . _pInst ) ; 
78- 
7978    this . clipPath  =  null ; 
8079  } 
8180
@@ -178,9 +177,10 @@ class Renderer2D extends Renderer {
178177      // create background rect 
179178      const  color  =  this . _pInst . color ( ...args ) ; 
180179
181-       //accessible Outputs 
182-       if  ( this . _pInst . _addAccsOutput ( ) )  { 
183-         this . _pInst . _accsBackground ( color . _getRGBA ( [ 255 ,  255 ,  255 ,  255 ] ) ) ; 
180+       // Add accessible outputs if the method exists; on success,  
181+       // set the accessible output background to white. 
182+       if  ( this . _pInst . _addAccsOutput ?. ( ) )  { 
183+         this . _pInst . _accsBackground ?. ( color . _getRGBA ( [ 255 ,  255 ,  255 ,  255 ] ) ) ; 
184184      } 
185185
186186      const  newFill  =  color . toString ( ) ; 
@@ -211,9 +211,10 @@ class Renderer2D extends Renderer {
211211    const  color  =  this . states . fillColor ; 
212212    this . _setFill ( color . toString ( ) ) ; 
213213
214-     //accessible Outputs 
215-     if  ( this . _pInst . _addAccsOutput ( ) )  { 
216-       this . _pInst . _accsCanvasColors ( 'fill' ,  color . _getRGBA ( [ 255 ,  255 ,  255 ,  255 ] ) ) ; 
214+       // Add accessible outputs if the method exists; on success,  
215+       // set the accessible output background to white. 
216+     if  ( this . _pInst . _addAccsOutput ?. ( ) )  { 
217+       this . _pInst . _accsCanvasColors ?. ( 'fill' ,  color . _getRGBA ( [ 255 ,  255 ,  255 ,  255 ] ) ) ; 
217218    } 
218219  } 
219220
@@ -222,9 +223,10 @@ class Renderer2D extends Renderer {
222223    const  color  =  this . states . strokeColor ; 
223224    this . _setStroke ( color . toString ( ) ) ; 
224225
225-     //accessible Outputs 
226-     if  ( this . _pInst . _addAccsOutput ( ) )  { 
227-       this . _pInst . _accsCanvasColors ( 'stroke' ,  color . _getRGBA ( [ 255 ,  255 ,  255 ,  255 ] ) ) ; 
226+       // Add accessible outputs if the method exists; on success,  
227+       // set the accessible output background to white. 
228+     if  ( this . _pInst . _addAccsOutput ?. ( ) )  { 
229+       this . _pInst . _accsCanvasColors ?. ( 'stroke' ,  color . _getRGBA ( [ 255 ,  255 ,  255 ,  255 ] ) ) ; 
228230    } 
229231  } 
230232
0 commit comments