Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
¿Cómo agregar una etiqueta Aria a un marcador de Google Maps?

Me gustaría agregar una etiqueta aria en un objeto marcador. Actualmente tengo una función que carga todos los marcadores y quiero poner una etiqueta aria como propiedad del marcador. Actualmente estoy poniendo la etiqueta aria como una propiedad cuando creo el objeto marcador, pero creo que esto puede estar mal. ¿Cómo podría agregar una etiqueta aria a un marcador?

 loadLocationMarkers({ lat, lng }, idx) { const markerIcon = this.createIcon(idx); const markerObj = new google.maps.Marker({ icon: markerIcon, index: idx, selected: idx === this.selected, map: this.map, position: new google.maps.LatLng(lat, lng), optimized: false, zIndex: this.calculateZIndex(idx), 'aria-label': 'Location Marker', }); if (markerObj.selected) { this.selectedMarkerObj = markerObj; } markerObj.addListener('click', () => { const index = markerObj.get('index'); this.dispatch(updateSelected(index), this.handleClick(markerObj)); }); return markerObj; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use el title que establecerá la aria-label .

https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.title

 new google.maps.Marker({ icon: markerIcon, index: idx, selected: idx === this.selected, map: this.map, position: new google.maps.LatLng(lat, lng), optimized: false, zIndex: this.calculateZIndex(idx), title: 'Location Marker', // <--- added this });

De la salida de la muestra de marcadores simples con title="Hello World!" .

 <div aria-label="Hello World!" role="img" tabindex="-1" ... > <img ... /><map ><area tabindex="-1" title="Hello World!" ... /></map> </div>

Nota : tabindex es -1 ya que no hay detector de eventos en el marcador.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!