Prevent unbounded z-index growth in draggable items#314
Merged
Edwardvaneechoud merged 2 commits intomainfrom Feb 6, 2026
Merged
Prevent unbounded z-index growth in draggable items#314Edwardvaneechoud merged 2 commits intomainfrom
Edwardvaneechoud merged 2 commits intomainfrom
Conversation
The bringToFront() and clickOnItem() functions incremented z-index on every click without any upper bound. These values persisted to localStorage, causing z-index values to grow into the hundreds/thousands across sessions and eventually overlap with modals, tooltips, and context menus. Changes: - Add BASE_Z_INDEX (100), MAX_Z_INDEX (200), FULLSCREEN_Z_INDEX (250) constants to bound the z-index range - Skip incrementing if the panel is already the topmost - Add normalizeZIndices() that compresses all panel z-indices back into [100, 100+n] when they exceed MAX_Z_INDEX - Clamp z-index values restored from localStorage to prevent inflated values from persisting - Deduplicate clickOnItem() to delegate to bringToFront() - Use bounded constants for fullscreen z-index (was 9999) https://claude.ai/code/session_01QnbcTGngNwdbBWVX9BT4Un
✅ Deploy Preview for flowfile-wasm canceled.
|
The previous change accidentally included the current item in the max z-index calculation and used >= comparison. This meant when all panels had the same z-index (initial state, after normalization, or after exiting fullscreen), no panel could be brought to front since its own z-index always equaled the max. Fix: exclude the current item (itemId !== id) from max calculation and use strict > for the "already on top" guard. https://claude.ai/code/session_01QnbcTGngNwdbBWVX9BT4Un
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements z-index management improvements to prevent unbounded growth of z-index values in the draggable item store. Z-index values are now constrained within defined ranges and automatically normalized when they exceed safe limits.
Key Changes
BASE_Z_INDEX(100),MAX_Z_INDEX(200), andFULLSCREEN_Z_INDEX(250) to replace magic numbers and establish clear boundariesnormalizeZIndices()function that resets non-fullscreen items to sequential z-index values starting fromBASE_Z_INDEXwhen values exceedMAX_Z_INDEXbringToFront()logic:MAX_Z_INDEXclickOnItem(): Now delegates tobringToFront()to avoid code duplication and ensure consistent z-index managementbringToFront()instead of direct z-index manipulation for consistencyImplementation Details
FULLSCREEN_Z_INDEXhttps://claude.ai/code/session_01QnbcTGngNwdbBWVX9BT4Un