@@ -6,8 +6,8 @@ export var AnnounceMovement = L.Handler.extend({
6
6
} ) ;
7
7
8
8
this . _map . options . mapEl . addEventListener ( 'moveend' , this . announceBounds ) ;
9
- this . _map . options . mapEl . addEventListener ( 'focus' , this . focusAnnouncement ) ;
10
9
this . _map . dragging . _draggable . addEventListener ( 'dragstart' , this . dragged ) ;
10
+ this . _map . options . mapEl . addEventListener ( 'mapfocused' , this . focusAnnouncement ) ;
11
11
} ,
12
12
removeHooks : function ( ) {
13
13
this . _map . off ( {
@@ -16,26 +16,32 @@ export var AnnounceMovement = L.Handler.extend({
16
16
} ) ;
17
17
18
18
this . _map . options . mapEl . removeEventListener ( 'moveend' , this . announceBounds ) ;
19
- this . _map . options . mapEl . removeEventListener ( 'focus' , this . focusAnnouncement ) ;
20
19
this . _map . dragging . _draggable . removeEventListener ( 'dragstart' , this . dragged ) ;
20
+ this . _map . options . mapEl . removeEventListener ( 'mapfocused' , this . focusAnnouncement ) ;
21
21
} ,
22
22
23
23
focusAnnouncement : function ( ) {
24
- let el = this . querySelector ( ".mapml-web-map" ) ? this . querySelector ( ".mapml-web-map" ) . shadowRoot . querySelector ( ".leaflet-container" ) :
25
- this . shadowRoot . querySelector ( ".leaflet-container" ) ;
26
-
27
- let mapZoom = this . _map . getZoom ( ) ;
28
- let location = M . gcrsToTileMatrix ( this ) ;
29
- let standard = " zoom level " + mapZoom + " column " + location [ 0 ] + " row " + location [ 1 ] ;
30
-
31
- if ( mapZoom === this . _map . _layersMaxZoom ) {
32
- standard = "At maximum zoom level, zoom in disabled " + standard ;
33
- }
34
- else if ( mapZoom === this . _map . _layersMinZoom ) {
35
- standard = "At minimum zoom level, zoom out disabled " + standard ;
36
- }
37
-
38
- el . setAttribute ( "aria-roledescription" , "region " + standard ) ;
24
+ let mapEl = this ;
25
+ setTimeout ( function ( ) {
26
+ let el = mapEl . querySelector ( ".mapml-web-map" ) ? mapEl . querySelector ( ".mapml-web-map" ) . shadowRoot . querySelector ( ".leaflet-container" ) :
27
+ mapEl . shadowRoot . querySelector ( ".leaflet-container" ) ;
28
+
29
+ let mapZoom = mapEl . _map . getZoom ( ) ;
30
+ let location = M . gcrsToTileMatrix ( mapEl ) ;
31
+ let standard = " zoom level " + mapZoom + " column " + location [ 0 ] + " row " + location [ 1 ] ;
32
+
33
+ if ( mapZoom === mapEl . _map . _layersMaxZoom ) {
34
+ standard = "At maximum zoom level, zoom in disabled " + standard ;
35
+ }
36
+ else if ( mapZoom === mapEl . _map . _layersMinZoom ) {
37
+ standard = "At minimum zoom level, zoom out disabled " + standard ;
38
+ }
39
+
40
+ el . setAttribute ( "aria-roledescription" , "region " + standard ) ;
41
+ setTimeout ( function ( ) {
42
+ el . removeAttribute ( "aria-roledescription" ) ;
43
+ } , 2000 ) ;
44
+ } , 0 ) ;
39
45
} ,
40
46
41
47
announceBounds : function ( ) {
0 commit comments