File tree 3 files changed +11
-6
lines changed
3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 3
3
*
4
4
* @param {string } ariaLive Optional. Value for the 'aria-live' attribute, default 'polite'.
5
5
*
6
- * @return {Object } $container The ARIA live region jQuery object .
6
+ * @return {HTMLDivElement } The ARIA live region HTML element .
7
7
*/
8
8
const addContainer = function ( ariaLive ) {
9
9
ariaLive = ariaLive || 'polite' ;
@@ -29,7 +29,11 @@ const addContainer = function( ariaLive ) {
29
29
container . setAttribute ( 'aria-relevant' , 'additions text' ) ;
30
30
container . setAttribute ( 'aria-atomic' , 'true' ) ;
31
31
32
- document . querySelector ( 'body' ) . appendChild ( container ) ;
32
+ const body = document . querySelector ( 'body' ) ;
33
+ if ( body ) {
34
+ body . appendChild ( container ) ;
35
+ }
36
+
33
37
return container ;
34
38
} ;
35
39
Original file line number Diff line number Diff line change @@ -14,14 +14,14 @@ import filterMessage from './filterMessage';
14
14
* Create the live regions.
15
15
*/
16
16
export const setup = function ( ) {
17
- let containerPolite = document . getElementById ( 'a11y-speak-polite' ) ;
18
- let containerAssertive = document . getElementById ( 'a11y-speak-assertive' ) ;
17
+ const containerPolite = document . getElementById ( 'a11y-speak-polite' ) ;
18
+ const containerAssertive = document . getElementById ( 'a11y-speak-assertive' ) ;
19
19
20
20
if ( containerPolite === null ) {
21
- containerPolite = addContainer ( 'polite' ) ;
21
+ addContainer ( 'polite' ) ;
22
22
}
23
23
if ( containerAssertive === null ) {
24
- containerAssertive = addContainer ( 'assertive' ) ;
24
+ addContainer ( 'assertive' ) ;
25
25
}
26
26
} ;
27
27
Original file line number Diff line number Diff line change 31
31
"noFallthroughCasesInSwitch" : true , /* Report errors for fallthrough cases in switch statement. */
32
32
},
33
33
"include" : [
34
+ " ./packages/a11y/**/*.js" ,
34
35
" ./packages/blob/**/*.js" ,
35
36
" ./packages/dom-ready/**/*.js" ,
36
37
" ./packages/i18n/**/*.js" ,
You can’t perform that action at this time.
0 commit comments