@@ -204,22 +204,27 @@ class PreviewFrame extends React.Component {
204204 ] ;
205205 const accessiblelib = sketchDoc . createElement ( 'script' ) ;
206206 accessiblelib . setAttribute ( 'src' , 'https://cdn.rawgit.com/MathuraMG/p5-accessibility/9cb5bd0b/dist/p5-accessibility.js' ) ;
207+ const accessibleOutputs = sketchDoc . createElement ( 'section' ) ;
208+ accessibleOutputs . setAttribute ( 'id' , 'accessible-outputs' ) ;
207209 if ( this . props . textOutput ) {
208- sketchDoc . getElementById ( 'accessibility-library' ) . appendChild ( accessiblelib ) ;
210+ sketchDoc . body . appendChild ( accessibleOutputs ) ;
211+ sketchDoc . body . appendChild ( accessiblelib ) ;
209212 const textSection = sketchDoc . createElement ( 'section' ) ;
210213 textSection . setAttribute ( 'id' , 'textOutput-content' ) ;
211214 sketchDoc . getElementById ( 'accessible-outputs' ) . appendChild ( textSection ) ;
212215 this . iframeElement . focus ( ) ;
213216 }
214217 if ( this . props . gridOutput ) {
215- sketchDoc . getElementById ( 'accessibility-library' ) . appendChild ( accessiblelib ) ;
218+ sketchDoc . body . appendChild ( accessibleOutputs ) ;
219+ sketchDoc . body . appendChild ( accessiblelib ) ;
216220 const gridSection = sketchDoc . createElement ( 'section' ) ;
217221 gridSection . setAttribute ( 'id' , 'gridOutput-content' ) ;
218222 sketchDoc . getElementById ( 'accessible-outputs' ) . appendChild ( gridSection ) ;
219223 this . iframeElement . focus ( ) ;
220224 }
221225 if ( this . props . soundOutput ) {
222- sketchDoc . getElementById ( 'accessibility-library' ) . appendChild ( accessiblelib ) ;
226+ sketchDoc . body . appendChild ( accessibleOutputs ) ;
227+ sketchDoc . body . appendChild ( accessiblelib ) ;
223228 const soundSection = sketchDoc . createElement ( 'section' ) ;
224229 soundSection . setAttribute ( 'id' , 'soundOutput-content' ) ;
225230 sketchDoc . getElementById ( 'accessible-outputs' ) . appendChild ( soundSection ) ;
0 commit comments