Closed taysea closed 1 year ago
Accessibility notes: (tested in voiceover)
Leaflet's accessibility guide: https://leafletjs.com/examples/accessibility/
Taylor's additions:
Reading through this and given some limitations may be on the leaflet side. My suggestions would be:
a11yTitle
to a marker/cluster that captures anything that would be in a popup?Cluster theming: Size should be specified outside of kind. This allows for generic sizes that can be used across kinds. Any props defined in a kind will take precedence over the size props. This structure gives us flexibility if down the road we need to support size within kind.
Theme structure:
cluster: {
default: {
// this is a kind of cluster
container: {
// any box props, will take precedence over box props defined in size
}
}
size: {
small: {
container: {
// any box props
}
label: {
// any text props
}
}
}
}
Capturing a discussion Jessica and I had offline re: theme structure: Should kind
objects be nested under another level called kind
?
This is different than grommet theme.button
. However, the rationale would be that a top-level theme object would refer to a property on a component. Then, the nested objects would align with accepted values for that property.
For example:
cluster: {
kind: {
critical: ...
},
...
}
<Cluster kind="critical" />
Not a strong opinion one way, but wanted to voice it before we publish and commit to a theme structure.
After digging into this, Jessica and I realized that beyond allowing the caller to pass custom box props to their Popup container, we should also support the ability for callers to pass accepted options for leaflet's popup (in terms of grommet-leaflet truly being an extension of leaflet and not to opinionated).
Some ideas we had were to:
boxProps
which would style the Popup container.Popup.jsx
const Popup = ({ boxProps, children ...rest}) => {
return (
<LeafletPopup {...rest}>
<Box {...theme.popup} {...boxProps}>
{children}
</Box>
</LeafletPopup>
}
Then the caller's implementation would be something like
<Marker>
<Popup autoClose={false} boxProps={{ pad: 'medium' }}>
<MyPopupContent>
</Popup>
</Marker>
This approach worked for the Markers but did not work for the Clusters which are using ReactDOMServer.renderToString
. An error that LeafletPopup
can't be used outside of MapContainer is thrown.
So we will need to think on other approaches and what the API surface should like.
I created two follow on tickets for the accessibility and popup work. https://github.com/grommet/grommet-leaflet/issues/44 https://github.com/grommet/grommet-leaflet/issues/45
Based on initial review of
grommet-leaflet-core
, the following action items remain:grommet-leaflet-core
togrommet-leaflet
(https://github.com/grommet/grommet-leaflet/pull/42)Deliverables might include: