File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
if ( ! ( "ariaNotify" in Element . prototype ) ) {
2
+ let uniqueId = Date . now ( ) ;
3
+ try {
4
+ uniqueId = crypto . randomUUID ( ) ;
5
+ } catch { }
6
+ const liveRegionCustomElementName = `live-region-${ uniqueId } ` ;
7
+
2
8
class MessageEvent extends Event {
3
9
constructor ( type , { message, ...options } ) {
4
10
super ( type , options ) ;
@@ -60,7 +66,7 @@ if (!("ariaNotify" in Element.prototype)) {
60
66
}
61
67
62
68
customElements . define (
63
- "live-region" ,
69
+ liveRegionCustomElementName ,
64
70
class extends HTMLElement {
65
71
#queue = new MessageQueue ( this ) ;
66
72
@@ -103,11 +109,11 @@ if (!("ariaNotify" in Element.prototype)) {
103
109
{ priority = "none" , interrupt = "none" } = { }
104
110
) {
105
111
// Re-use 'live-region', if it already exists
106
- let liveRegion = document . querySelector ( "live-region" ) ;
112
+ let liveRegion = document . querySelector ( liveRegionCustomElementName ) ;
107
113
108
114
// Create 'live-region', if it doesn’t exist
109
115
if ( ! liveRegion ) {
110
- liveRegion = document . createElement ( "live-region" ) ;
116
+ liveRegion = document . createElement ( liveRegionCustomElementName ) ;
111
117
document . body . appendChild ( liveRegion ) ;
112
118
}
113
119
You can’t perform that action at this time.
0 commit comments