When attempting to style the webkit scrollbar thumb, polygon works for me but rect does not. I tried recreating this exact svg in normal HTML and it worked, but does not when used as a background-image for this psuedo element. Is it just displaying out of screen or is there something about the rect written incorrectly?
Working code:
&::-webkit-scrollbar-thumb {
background: #9C9CFF;
border: ${borderSize}px solid black;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='rgb(96, 96, 96)'><polygon points='50,00 0,50 100,50'/></svg>");
}
Broken code: everything the same, just add a rect
&::-webkit-scrollbar-thumb {
background: #9C9CFF;
border: ${borderSize}px solid black;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='rgb(96, 96, 96)'><polygon points='50,00 0,50 100,50'/><rect width='180' height='180' fill='#000' /></svg>");
}
The polygon disappears as well after adding the rect
If the compilation process may matter, this is code inside of a emotion styled-component, inside react using the basic create-react-app webpack setup.
Without the rect the scrollbar thumb looks like this, with the rect it just has the purple background and no shapes