Skip to content

Commit fedd0d8

Browse files
Kevin Heneveldclaude
authored andcommitted
feat(modal): accept an optional overlayZIndex prop for nested-modal stacking
The shared Modal component's overlay defaults to z-index 3000. When one Modal is opened from inside another whose overlay has bumped its z-index — a pattern used by some consumers to ensure their modal stays above its parent — opening a default-z-index Modal from inside that one renders the nested Modal *behind* the parent overlay. The screen darkens (both overlays compound) but the new Modal's content is invisible and uninteractive. Add an optional `overlayZIndex: Number` prop that, when supplied, is applied as an inline style on the overlay div. The default is left undefined so the global `.modal-overlay { z-index: 3000 }` rule still wins for every existing caller — strictly additive, no behaviour change for anyone who doesn't opt in. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e1686a6 commit fedd0d8

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Added
11+
- **`Modal` accepts an optional `overlayZIndex` prop:** The shared `Modal` component's overlay defaults to `z-index: 3000`. When one Modal is opened from inside another whose overlay has bumped its z-index (a pattern used by some consumers to ensure the inner modal sits above its parent), opening a default-z-index Modal from inside it renders the new modal *behind* the parent overlay — the screen darkens (both overlays compound) but the new modal's content is invisible/uninteractive. The new `overlayZIndex` prop lets a nested-modal caller pass a value higher than the parent's overlay so the nested Modal stacks on top. The prop is omitted by default; behaviour for every existing caller is unchanged.
12+
813
## [0.2.71] - 2026-04-17
914

1015
### Added

fe/src/components/feedback/Modal.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
-->
1818
<template>
1919
<teleport to="body">
20-
<div v-if="visible" class="modal-overlay" @click.self="onClose">
20+
<div
21+
v-if="visible"
22+
class="modal-overlay"
23+
:style="overlayStyle"
24+
@click.self="onClose"
25+
>
2126
<div
2227
ref="contentRef"
2328
class="modal-content"
@@ -70,6 +75,12 @@ const props = defineProps({
7075
title: { type: String, default: '' },
7176
showClose: { type: Boolean, default: true },
7277
size: { type: String as () => 'sm' | 'md' | 'lg', default: 'md' },
78+
// Optional inline-style override for the overlay's z-index. Useful when this
79+
// Modal is opened from inside another modal whose overlay has bumped its
80+
// z-index above the global default of 3000; pass a value higher than the
81+
// parent's overlay so the nested Modal stacks on top instead of rendering
82+
// behind a darker (compounded) parent overlay. Omit to keep the default.
83+
overlayZIndex: { type: Number, default: undefined },
7384
})
7485
const emit = defineEmits(['close'])
7586
@@ -81,6 +92,10 @@ const sizeClass = computed(() => {
8192
return props.size === 'sm' ? 'modal-sm' : props.size === 'lg' ? 'modal-lg' : 'modal-md'
8293
})
8394
95+
const overlayStyle = computed(() =>
96+
props.overlayZIndex != null ? { zIndex: props.overlayZIndex } : undefined,
97+
)
98+
8499
const contentRef = ref<HTMLElement | null>(null)
85100
const ariaLabelledBy = ref<string | undefined>(undefined)
86101
let modalObserver: MutationObserver | null = null

0 commit comments

Comments
 (0)