z-index Stacking Context Boundary Check

Audit supplied containing stacking-context ancestry; descendant local z-index cannot escape ancestor contexts, and unrelated roots are not ordered. Explicit supplied computed/layout context only; not a browser cascade/layout engine or cross-browser guarantee.

Description

A stacking context groups local paint-order comparisons within a larger hierarchy.

A stacking context groups local paint-order comparisons within a larger hierarchy.1

Equal local z-index values from different contexts do not by themselves determine global stacking order. Use z-index Stacking Context Boundary Check to evaluate the supplied inputs under the specific model below.

When to use z-index Stacking Context Boundary Check

Use z-index Stacking Context Boundary Check to evaluate the supplied inputs under the specific model below. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.

How to use z-index Stacking Context Boundary Check and understand its results

  1. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.
  2. Enter First stacking context path, Second stacking context path, First local z index, Second local z index using the field table and validation rules below, then run the tool.
  3. Read Local z indices directly comparable, Common context depth and interpret units, signs, ordering and placeholders as explained below.
  4. If the tool reports an input error, correct that field and rerun. A successful false result, empty match list or unknown-evidence placeholder has the specific meaning described here; check the limitations before applying the result.
Input fieldMeaningValue typeRequirement
firstStackingContextPathFirst stacking context patharray of stringRequired; constraints below
secondStackingContextPathSecond stacking context patharray of stringRequired; constraints below
firstLocalZIndexFirst local z indexnumberRequired; constraints below
secondLocalZIndexSecond local z indexnumberRequired; constraints below

Enter two root-to-containing-stacking-context ID paths and finite local z-index values. The tool counts their shared leading IDs and reports direct comparability only when both entire context paths are identical. The supplied z-index numbers are validated but do not affect either output. A different-context result does not determine which element paints on top; the tool does not inspect a DOM or compare ancestor stacking levels.

sharedDepth = length(commonPrefix(pathA,pathB)); directlyComparable = identicalPaths

Field order, units and branch conditions follow the implementation explanation above.

Output fieldMeaningValue type
localZIndicesDirectlyComparableLocal z indices directly comparableboolean
commonContextDepthCommon context depthnumber
json
{
  "input": {
    "firstStackingContextPath": [
      "root",
      "a"
    ],
    "secondStackingContextPath": [
      "root",
      "b"
    ],
    "firstLocalZIndex": 999,
    "secondLocalZIndex": 1
  },
  "output": {
    "localZIndicesDirectlyComparable": false,
    "commonContextDepth": 1
  }
}

Limitations and assumptions

Equal local z-index values from different contexts do not by themselves determine global stacking order. Apply the exact scope and assumptions described above.

All listed fields require explicit values. Unexpected fields, incorrect types, nonfinite numbers and sparse arrays fail validation. Domain-specific bounds, alignments and supported tokens are stated above; extremely large inputs or outputs can also be rejected. These errors differ from successful results such as false, no matches or unknown evidence.

Alternative or Complementary methods

Use isolation Stacking Context Fix Note for a related task: Isolation can create a stacking context and restrict blending with the outside backdrop.

Use @layer revert-layer Cascade Order Lookup for a related task: Cascade layers have ordering rules that differ for normal and important declarations.

References

  1. z-index Stacking Context Boundary Check — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies