Menu

Make the agent keep the existing z-index scale — no magic z-index values
📰

Make the agent keep the existing z-index scale — no magic z-index values

DEV Community: css·Sherotree·about 13 hours ago
#NpLiBCsx
#devtocss#devto#dev#index#scale
Reading 0:00
15s threshold

The modal is under the sticky header again. The agent “fixes” it with z-index: 9999 on the dialog, 10000 on the toast, and 1 on a tooltip that now punches through a drawer. The visual bug is gone in that one storybook story. The stacking scale is not.

I’ve started treating a magic z-index in an agent UI patch as a review comment , not a mergeable polish. If the repo already has --z-dropdown , --z-modal , and --z-toast , the model should pick one of those — or propose a new token in the same file — not invent 9999.

Why 9999 is a trap

A z-index scale is a contract. Once three components pick random four-digit numbers, every later overlay has to guess higher. Portals, sticky headers, and third-party widgets make the guessing worse. The next agent session cannot see the implicit “we already used 10000,” so it uses 10001.

The number also hides the real bug. A popover under a header is often a stacking context problem ( isolation , transform , filter , or a parent z-index ), not a missing 9999.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.