Partial fix Choosing the same color option in basic colors palette causes errors

Steve F

Well-known member
Affected version
2.0.1
So for example go to contentAltBg (Alternate content background color) and choose from within the picker the same palette, Alternate content background color, then save. Results are a broken front end and js errors in the ACP.

1514411053743.webp

Edit: I know we shouldn't be choosing the same color, I discovered this literally by accident.
 
Last edited:
I've fixed the JS errors, which were caused by an infinite loop trying to resolve the color. I've also made a change so that you can't select a property itself in the color picker.

However, there are other ways to create indirect loops that we can't really resolve. For example, the altnerate content BG color references the content BG itself, so if you make content BG reference the alt color, you'll get an infinite loop. We detect this and resolve the value to an empty string, which then makes some of the LESS invalid as there are blank strings where we assume there should be colors. You can also trigger this by emptying one of the colors entirely, for example.

So in that regard, the broken output on the front end isn't something that I'd consider an explicit bug, but an indication that you did something that we couldn't handle and you need to fix it. (The only workaround would be to use the word "transparent" in the case of a loop, though that wouldn't really be ideal in other scenarios.) As is, I don't think this is a situation we need to worry about too much.
 
Back
Top Bottom