diff --git a/samples/advanced-markers-accessibility/index.html b/samples/advanced-markers-accessibility/index.html index 1eb28a32..0489d6fe 100644 --- a/samples/advanced-markers-accessibility/index.html +++ b/samples/advanced-markers-accessibility/index.html @@ -11,13 +11,13 @@ - - -
+ ({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"}); + + + diff --git a/samples/advanced-markers-accessibility/index.ts b/samples/advanced-markers-accessibility/index.ts index ad2204f1..81f21a63 100644 --- a/samples/advanced-markers-accessibility/index.ts +++ b/samples/advanced-markers-accessibility/index.ts @@ -5,16 +5,15 @@ */ // [START maps_advanced_markers_accessibility] +const mapElement = document.querySelector('gmp-map') as google.maps.MapElement; +let innerMap; + async function initMap() { // Request needed libraries. const { Map, InfoWindow } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; const { AdvancedMarkerElement, PinElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary; - const map = new Map(document.getElementById("map") as HTMLElement, { - zoom: 12, - center: { lat: 34.84555, lng: -111.8035 }, - mapId: '4504f8b37365c3d0', - }); + innerMap = mapElement.innerMap; // Set LatLng and title text for the markers. The first marker (Boynton Pass) // receives the initial focus when tab is pressed. Use arrow keys to move @@ -54,11 +53,12 @@ async function initMap() { // [START maps_advanced_markers_accessibility_marker] const marker = new AdvancedMarkerElement({ position, - map, title: `${i + 1}. ${title}`, content: pin.element, gmpClickable: true, }); + + mapElement.append(marker); // [END maps_advanced_markers_accessibility_marker] // [START maps_advanced_markers_accessibility_event_listener] // Add a click listener for each marker, and set up the info window. @@ -73,4 +73,4 @@ async function initMap() { } initMap(); -// [END maps_advanced_markers_accessibility] \ No newline at end of file +// [END maps_advanced_markers_accessibility]