Closed JStuve closed 10 months ago
I'm curious why replace the arrow completely on hover? Why not just have like
activeClassName
or something?
That's a great question! It seems to be possible, however there is a lack of browser support for utilizing fill: 'context-stroke'
, which would inherit the stroke of the path and ultimately make this solution much cleaner. See Example 2.
The next best option is to create the individual marker definitions and referencing them by their unique id via the marker-end
attribute. Since the marker ends are reference in the svg def, and not from an element within the path, targeting that element, from what I've seen, is only done through the attribute.
Here is a good SO post on this, one of the more recent comments circles back to the SVG documentation
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
On hover of an edge, the marker arrow does not match the edge hover color. This was a feature request over in the JSON Crack repo: JSON Crack Issue 236
Issue Number: N/A
What is the new behavior?
On hover of an edge, the marker will now match the edge color for default, active and disabled edge states.
Does this PR introduce a breaking change?
Other information
Adding dynamic styling to marker ends does required individual markers to be defined. I was able to solve for the default behavior while allowing users to define their own hover marker for anything custom.