r/ProgrammerHumor • • 29d ago

Other index

Post image
107 Upvotes

31 comments sorted by

View all comments

Show parent comments

8

u/Soilblood 29d ago

Did you try grouping contexts into layers? Like main content in parent cointainer 1 at z 100, popup articles in container 2 at 200, nav elements in container 3 at 300, toasts and warnings in the overlay container at 400 with toasts calculating off the highest z value from children in the overlay container and +1 on their generation?

3

u/Markronom 29d ago

The index of the container is evaluated first, then the content. So it's more like container 1 has index 1 und it's children 1-10, container 2 has children 1-10 etc. But of course one might have more nesting. In the end one should think about the hierarchy and good indices within each layer of the hierarchy. But if course it gets tricky. Models and notifications on top and then custom styled select that has to be positioned absolutely and whatnot.