When using the mouseenter
event, I have a JavaScript function applied to an svg path element
:
const fadeIn = (event, locale) => {
event.target.style.fill = 'hwb(' + (120 - score[locale] * 1.2) + ' 0% 0% / 1)'
}
This function works alongside a CSS transition
:
transition: fill .25s;
The issue arises when the stroke
overlaps between different svg paths
, and the only way to bring the hovered element's stroke to the front is by adding this line to the JS function:
event.target.parentElement.appendChild(event.target)
However, this method doesn't seamlessly integrate with the transition
. Applying a class is not an ideal solution as it requires access to the score
and locale
parameters within the hwb()
color style property.
Is there a workaround that maintains the element at the forefront while ensuring the transition functions correctly?