@@ -220,6 +220,7 @@ export default function MapView({
220220 const initialMapPinZoomStyleRef = useRef < MapPinZoomStyle | null > ( null ) ;
221221 const pendingPinZoomRef = useRef < number | null > ( null ) ;
222222 const pinZoomAnimationFrameRef = useRef < number | null > ( null ) ;
223+ const hasSyncedIdleBoundsRef = useRef ( false ) ;
223224 const saveMapViewTimeoutRef = useRef < ReturnType < typeof setTimeout > | null > (
224225 null
225226 ) ;
@@ -350,10 +351,17 @@ export default function MapView({
350351
351352 const handleLoad = useCallback ( ( ) => {
352353 handleMapLoad ( ) ;
353- const map = syncCurrentMapState ( ) ;
354- map ?. once ( "idle" , syncCurrentMapState ) ;
354+ hasSyncedIdleBoundsRef . current = false ;
355+ syncCurrentMapState ( ) ;
355356 } , [ handleMapLoad , syncCurrentMapState ] ) ;
356357
358+ const handleIdle = useCallback ( ( ) => {
359+ if ( hasSyncedIdleBoundsRef . current ) return ;
360+
361+ hasSyncedIdleBoundsRef . current = true ;
362+ syncCurrentMapState ( ) ;
363+ } , [ syncCurrentMapState ] ) ;
364+
357365 useEffect ( ( ) => {
358366 if ( initialCoordinates ) {
359367 lastSavedMapViewRef . current = initialCoordinates ;
@@ -485,6 +493,8 @@ export default function MapView({
485493 return (
486494 < MapContainer
487495 ref = { mapContainerRef }
496+ role = "region"
497+ aria-label = { t ( "mapRegionLabel" ) }
488498 data-testid = "map-view"
489499 style = { initialMapPinZoomStyleRef . current ?? undefined }
490500 >
@@ -501,6 +511,7 @@ export default function MapView({
501511 onZoom = { handleMove }
502512 onMoveEnd = { handleMoveEnd }
503513 onLoad = { handleLoad }
514+ onIdle = { handleIdle }
504515 onError = { handleMapError }
505516 onClick = { handleMapClickInternal }
506517 >
@@ -515,6 +526,7 @@ export default function MapView({
515526
516527 < MapPinLayer
517528 listings = { listings }
529+ markerLabel = { t ( "markerLabel" ) }
518530 selectedListingId = { selectedListingId }
519531 onMarkerClick = { onMarkerClick }
520532 />
@@ -524,12 +536,13 @@ export default function MapView({
524536 latitude = { userCoordinates . latitude }
525537 anchor = "center"
526538 >
527- < UserLocationDot />
539+ < UserLocationDot aria-hidden = "true" />
528540 </ Marker >
529541 ) : null }
530542 </ Map >
531543
532544 < MapControls
545+ controlsLabel = { t ( "controlsLabel" ) }
533546 locateActive = { Boolean ( userCoordinates ) }
534547 locateLabel = { t ( "locateControl" ) }
535548 onLocate = { handleLocate }
@@ -539,6 +552,7 @@ export default function MapView({
539552 searchLabel = { t ( "searchLabel" ) }
540553 zoomInDisabled = { isZoomInDisabled }
541554 zoomInLabel = { t ( "zoomInControl" ) }
555+ zoomControlsLabel = { t ( "zoomControlsLabel" ) }
542556 zoomOutLabel = { t ( "zoomOutControl" ) }
543557 />
544558 < MapSearch
@@ -549,11 +563,15 @@ export default function MapView({
549563 />
550564 </ >
551565 ) : (
552- < LoadingChip > { t ( "loadingPins" ) } </ LoadingChip >
566+ < LoadingChip role = "status" aria-live = "polite" >
567+ { t ( "loadingPins" ) }
568+ </ LoadingChip >
553569 ) }
554570
555571 { hasInitialPosition && isFetching && (
556- < LoadingChip > { t ( "loadingPins" ) } </ LoadingChip >
572+ < LoadingChip role = "status" aria-live = "polite" >
573+ { t ( "loadingPins" ) }
574+ </ LoadingChip >
557575 ) }
558576
559577 { showReturnButton && (
0 commit comments