r/ProgrammerHumor • • Oct 05 '26

Other index

Post image
105 Upvotes

31 comments sorted by

View all comments

31

u/Markronom Oct 05 '26

I've seen this a lot before AI. And gave up on centralising it in a previous app. It's also not only the index that matters, but also the stacking context

8

u/Soilblood Oct 05 '26

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 Oct 05 '26

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.

2

u/MikemkPK Oct 06 '26

I'm guilty of this myself. Set something as 1000, next thing as 990, the 995, 998, 999, "uh, no can do."