Allow advanced markers to be used in block form #202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been working on a client project where we're beginning to adopt advanced markers. The work that @colenso did on #192 has been much appreciated. But as I work with them further, I'm starting to hit a few use cases where having the ability to work with advanced markers in block form would ease some of the UI interactions we're working to build out.
TL;DR
We're seeing two items that block form would unlock:
@contentworks well enough for SVG markup, but gets messy when dealing with more complex templates and reacting to state changes / rendering additional componentsMy suggestion is we allow using markers as block elements if desired. This doesn't wish anything new on existing consumers but gives us both the ability to register additional modifiers on the core
contentelement and greater flexibility with the HTML rendered within the markerBackground
We're currently setting up SVG marker elements using a getter which allows us to react in basic ways to state changes. That has worked reasonably well for us over the last few years.
But that combination started breaking once we needed to register additional custom events on the
AdvancedMarkerElementbeyond what our commononEventNameapproach handles or what the default element emits. In our case, we specifically want to allow context menu interaction with a given marker element. The fact that the default don't have this makes complete sense (context-menu pop-ups aren't common when dealing with markers) but in our particular use case, they're both quite helpful and intuitive.But switching to passing through our own custom element as a
@contentvalue ended up breaking default event handler registration (could dig in on this further if needed, but was seeing it break bothonClickandonDragendevent handlers). Accessing the built / rendered AdvanedMarkerElement from JS is in theory possible but we currently lack an element in the DOM to register handlers against:More comments on the PR itself