In the current state, my application showcases high dynamism. A list of components is received and inserted into the DOM individually, without repetition. The order in which the components appear is not constant.
However, a peculiar scenario arises when 4 document widgets are added:
https://i.sstatic.net/TVMO0.png
If these widgets are toggled, the add icon remains fixed at the top:
https://i.sstatic.net/gkkok.png
Here's the styling applied to the 'X' icon:
element.style {
position: absolute;
margin: -10px;
z-index: 200;
width: auto;
inset: 0px 0px auto auto;
}
Currently, I manually resolve this issue by reducing the z-index value for each 'X' icon sequentially. For example, starting from 200 downwards like 200, 199, 198, 197: https://i.sstatic.net/lIlmb.png
My query pertains to ensuring that the z-index implementation decrements automatically as the component appears in the DOM. Can someone provide guidance on how to achieve this?
An illustrative small example is provided below: http://jsfiddle.net/f8jn04tb/1/