Maps4HTML / MapML.js

A custom <mapml-viewer> and <layer-> element suite
https://maps4html.org/MapML.js/
Other
58 stars 16 forks source link

Support HTML attributes on MapML elements #485

Open Malvoz opened 3 years ago

Malvoz commented 3 years ago

To satisfy a11y and i18n requirements - HTML attributes such as the following should be supported on MapML elements:

Example lang attribute usage:

Input Expected output
<layer- lang="en"> <div class="leaflet-layer mapml-layer" lang="en">
<mapml- lang="en"> <div class="leaflet-layer mapml-layer" lang="en">
<map-feature lang="en"> <g ... lang="en"> (?)
<map-featurecaption lang="en"> <g ... lang="en"> (?)
<map-properties lang="en"> Current closest ancestor is <div class="mapml-popup-content">, it's problematic to set lang here because this container also holds the mapml-focus-buttons. Need a new <div> container as child of <div class="mapml-popup-content"> for <map-properties> content (e.g. class="mapml-feature-properties" lang="en").
<map-a lang="en"> <g ... lang="en"> / <path ... lang="en"> (nested <map-a>)
<map-span lang="en"> <map-span lang="en">

(There may be use cases for these attributes on other MapML elements, TBD.)

The above seems unnecessarily complex, implementing this may be more easily achieved if this polyfill used a "live DOM model" approach, but I think that requires forking Leaflet (or other lib).


MapML parity (TODO):

ahmadayubi commented 3 years ago

This would require translations to be packaged with the mapml-viewer. I believe @prushforth wanted to keep translations (the strings for various languages themselves) in the extension, with the viewer only being shipped with English,

I think it's important to come to an consensus on where the translation information itself should be kept.

Although since this is just a prototype of how web maps in browsers would work, these attributes could be used by the extension to set the language. The attributes would then only work when the extension is installed.

Malvoz commented 3 years ago

I've updated this issue to focus on supporting HTML attributes on MapML elements in general, as opposed to only i18n-related attributes.