CON-1809 | Fix overlapping of anchored element

I understand that this requires less code but on other hand modifying variable state inside conditional check makes the code harder to understand.