Skip to content

Commit 7d6819b

Browse files
authored
Use hidden attribute for image maps (Maps4HTML#490)
* Use `hidden` attribute for posters * Increase delay in keyboardInteraction test
1 parent 4a1f374 commit 7d6819b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/web-map.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,12 @@ export class WebMap extends HTMLMapElement {
248248
}
249249
}
250250

251-
// undisplay the img in the image map, because it's not needed now
252-
// gives a slight fouc, not optimal
251+
// undisplay the img in the image map, because it's not needed now.
252+
// gives a slight FOUC, unless:
253+
// 1) the img is pre-styled (https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/80a4a4e372d2ef61bb7cad6a111e17e396b8e908/index-map-area.html#L35)
254+
// 2) placed after the map element
253255
if (this.poster) {
254-
this.poster.style.display = 'none';
256+
this.poster.setAttribute('hidden', '');
255257
}
256258

257259
// https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/274

test/e2e/core/keyboardInteraction.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jest.setTimeout(50000);
3232

3333
test("[" + browserType + "]" + " Crosshair remains on map move with arrow keys", async () => {
3434
await page.keyboard.press("ArrowUp");
35-
await page.waitForTimeout(500);
35+
await page.waitForTimeout(1000);
3636
await page.keyboard.press("ArrowDown");
37-
await page.waitForTimeout(500);
37+
await page.waitForTimeout(1000);
3838
await page.keyboard.press("ArrowLeft");
39-
await page.waitForTimeout(500);
39+
await page.waitForTimeout(1000);
4040
await page.keyboard.press("ArrowRight");
41-
await page.waitForTimeout(500);
41+
await page.waitForTimeout(1000);
4242
const afterMove = await page.$eval("div > div.mapml-crosshair", (div) => div.style.visibility);
4343
expect(afterMove).toEqual("");
4444
});

0 commit comments

Comments
 (0)