-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I see some problems with reusing the map
element as currently specified:
- The model for client side image maps and web maps are fundamentally different.
- For client side image maps, you can have multiple
img
elements refer to a singlemap
element, and both images apply the map's areas. (Example.) Theimg
is what renders the image, and themap
only provides the link between theimg
and thearea
s. Thearea
s are hyperlinks that can receive focus and clicks. Themap
itself has no special rendering. - For web maps, there is no
img
element, instead themap
element is the "widget" that owns the rendering and interaction model with panning and zooming.
- For client side image maps, you can have multiple
- The duality means that a
map
element needs to be able to "upgrade" to a web map. In Review of MapML-Proposal explainer MapML-Proposal#17 (comment) @Malvoz thought this could be toggled by the presence oflayer
elements. This means extra implementation complexity:- UAs need to have a mutation observer for all
map
elements to watch for added and removedlayer
children, and be able to toggle the "web map" rendering on and off in response.
- UAs need to have a mutation observer for all
map
is, for better or worse, not getting much love from browser vendors. Although there were evidence that web developers wanted variable-size image maps in 2015, the only improvement since then has been alignment oncoords
parsing in the spec (implemented in 2 out of 3 browser engines).- The web compat impact of making changes to the
map
element is unknown and needs research.map
is used on 1.96% of the web (httparchive data).
Benefits to using map
:
- the element name makes sense for the feature
- the client side image map feature could be considered to be a "simple map", so per Evolution not Revolution design principle it can make sense to extend client side image maps. However, I think the first 2 points above show that it's not an extension but opting in to a different model.
A new element name that doesn't show up in httparchive (check with https://rainy-periwinkle.glitch.me/ - via https://almanac.httparchive.org/en/2019/markup ) has these benefits:
- Close to zero web compat risk (so no in-depth web compat research needed)
- No "unnecessary" implementation complexity - the web map rendering would be "always on".
If you want to change the model to actually reuse map
's existing model, you would extend img
to support panning and zooming and so on, and keep map
as a "provides data" element. But I haven't thought about the implications of that yet.