Skip to content

Problems with reusing the map element #97

@zcorpan

Description

@zcorpan

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 single map element, and both images apply the map's areas. (Example.) The img is what renders the image, and the map only provides the link between the img and the areas. The areas are hyperlinks that can receive focus and clicks. The map itself has no special rendering.
    • For web maps, there is no img element, instead the map element is the "widget" that owns the rendering and interaction model with panning and zooming.
  • 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 of layer elements. This means extra implementation complexity:
    • UAs need to have a mutation observer for all map elements to watch for added and removed layer children, and be able to toggle the "web map" rendering on and off in response.
  • 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 on coords 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions