Skip to content

Commit

Permalink
feat(marker.ts): only add aria-label if the custom element does not a…
Browse files Browse the repository at this point in the history
…lready has one
  • Loading branch information
liorchamla committed Jan 6, 2025
1 parent 0061f85 commit 6861c64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## main

### ✨ Features and improvements

- Now only adds `aria-label` on the Marker's element if it does not already has one ([#5298](https://github.com/maplibre/maplibre-gl-js/pull/5298))

- _...Add new stuff here..._

### 🐞 Bug fixes
Expand Down
6 changes: 5 additions & 1 deletion src/ui/marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,11 @@ export class Marker extends Evented {
addTo(map: Map): this {
this.remove();
this._map = map;
this._element.setAttribute('aria-label', map._getUIString('Marker.Title'));

// If the element does not have an aria-label, we must provide it with the default Marker.Title
if (!this._element.hasAttribute('aria-label')) {
this._element.setAttribute('aria-label', map._getUIString('Marker.Title'));
}

map.getCanvasContainer().appendChild(this._element);
map.on('move', this._update);
Expand Down

0 comments on commit 6861c64

Please sign in to comment.