Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/mapml-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ export class MapViewer extends HTMLElement {
this._addToHistory();
// the attribution control is not optional
this._attributionControl = this._map.attributionControl.setPrefix('<a href="https://www.w3.org/community/maps4html/" title="W3C Maps for HTML Community Group">Maps4HTML</a> | <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>');

this._attributionControl.getContainer().setAttribute("role","group");
this._attributionControl.getContainer().setAttribute("aria-label","Map data attribution");

this.setControls(false,false,true);
this._crosshair = M.crosshair().addTo(this._map);

Expand Down
2 changes: 2 additions & 0 deletions src/web-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ export class WebMap extends HTMLMapElement {
this._addToHistory();
// the attribution control is not optional
this._attributionControl = this._map.attributionControl.setPrefix('<a href="https://www.w3.org/community/maps4html/" title="W3C Maps for HTML Community Group">Maps4HTML</a> | <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>');
this._attributionControl.getContainer().setAttribute("role","group");
this._attributionControl.getContainer().setAttribute("aria-label","Map data attribution");

this.setControls(false,false,true);
this._crosshair = M.crosshair().addTo(this._map);
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/core/mapElement.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,10 @@ describe("Playwright Map Element Tests", () => {

expect(projection).toEqual("OSMTILE");
});
test("Ensure attribution control has role='group' aria-label='Map data attribution'", async () => {
let role = await page.evaluate(`document.querySelector('map')._attributionControl.getContainer().getAttribute('role')`);
expect(role).toEqual("group");
let arialabel = await page.evaluate(`document.querySelector('map')._attributionControl.getContainer().getAttribute('aria-label')`);
expect(arialabel).toEqual("Map data attribution");
});
});
8 changes: 8 additions & 0 deletions test/e2e/mapml-viewer/mapml-viewer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ describe("Playwright mapml-viewer Element Tests", () => {
afterAll(async function () {
await context.close();
});

test("Ensure attribution control has role='group' aria-label='Map data attribution'", async () => {
let role = await page.evaluate(`document.querySelector('mapml-viewer')._attributionControl.getContainer().getAttribute('role')`);
expect(role).toEqual("group");
let arialabel = await page.evaluate(`document.querySelector('mapml-viewer')._attributionControl.getContainer().getAttribute('aria-label')`);
expect(arialabel).toEqual("Map data attribution");
});


test("Initial map element extent", async () => {
const extent = await page.$eval(
Expand Down