I'm having trouble figuring out how to make the rect element change color to purple when the text is highlighted. Right now, only the text color is changing. Is there a way to achieve this using just CSS?
The goal is for the rect to turn purple on hover over the text.
.chart rect {
//fill: steelblue;
stroke: black;
}
.x.axis path {
display: none;
}
text {
text-anchor: middle;
alignment-baseline="middle";
}
rect:hover {
fill: purple;
}
rect ~ text:hover {
fill: purple
}
<svg class="chart" width="800" height="60>
<g transform="translate(108.2258064516129,30)">
<rect width="206.4516129032258" height="29" fill="orange"></rect>
<text x="103.2258064516129" y="15" dy=".35em">ABB vs BBA</text>
<text x="103.2258064516129" y="-20" dy=".35em" style="fill: black;">Round 2</text>
</g>
</svg>