Skip to content

Commit 892ac4d

Browse files
committed
US206196 set overlay inside modal outer container.
1 parent 096fa8c commit 892ac4d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

elements/pfe-modal/src/pfe-modal.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<slot name="pfe-modal--trigger"></slot>
2-
<section class="pfe-modal__overlay" hidden>
2+
<section class="pfe-modal__outer" hidden>
3+
<div class="pfe-modal__overlay"></div>
34
<div class="pfe-modal__wrapper" tabindex="0" role="dialog" hidden>
45
<div class="pfe-modal__container">
56
<slot name="pfe-modal--header"></slot>

elements/pfe-modal/src/pfe-modal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class PfeModal extends PFElement {
7171
this._modalCloseButton = this.shadowRoot.querySelector(`.${this.tag}__close`);
7272
this._overlay = this.shadowRoot.querySelector(`.${this.tag}__overlay`);
7373
this._container = this.shadowRoot.querySelector(`.${this.tag}__container`);
74+
this._outer = this.shadowRoot.querySelector(`.${this.tag}__outer`);
7475

7576
this._observer = new MutationObserver(() => {
7677
this._mapSchemaToSlots(this.tag, this.slots);
@@ -165,13 +166,15 @@ class PfeModal extends PFElement {
165166
// Reveal the container and overlay
166167
this._modalWrapper.removeAttribute("hidden");
167168
this._overlay.removeAttribute("hidden");
169+
this._outer.removeAttribute("hidden");
168170
// Set the focus to the container
169171
this._modalWrapper.focus();
170172
} else {
171173
this.open = false;
172174
// Hide the container and overlay
173175
this._modalWrapper.setAttribute("hidden", true);
174176
this._overlay.setAttribute("hidden", true);
177+
this._outer.setAttribute("hidden", true);
175178
// Move focus back to the trigger element
176179
this.trigger.focus();
177180
}

elements/pfe-modal/src/pfe-modal.scss

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $pfe-modal--breakpoint--medium: 640px;
2222
}
2323

2424
.pfe-modal {
25-
&__overlay {
25+
&__outer {
2626
display: flex;
2727
position: fixed;
2828
height: 100%;
@@ -33,6 +33,18 @@ $pfe-modal--breakpoint--medium: 640px;
3333
align-items: center;
3434
justify-content: center;
3535
z-index: 2;
36+
37+
&[hidden] {
38+
display: none;
39+
z-index: 0;
40+
}
41+
}
42+
&__overlay {
43+
position: fixed;
44+
height: 100%;
45+
width: 100%;
46+
top: 0;
47+
left: 0;
3648
background-color: pfe-local($cssvar: BackgroundColor, $region: overlay);
3749
cursor: pointer;
3850

@@ -42,6 +54,7 @@ $pfe-modal--breakpoint--medium: 640px;
4254
}
4355
&__wrapper {
4456
z-index: 2;
57+
position: relative;
4558
max-width: pfe-local(MaxWidth--mobile);
4659
min-width: pfe-local(MinWidth);
4760
min-height: pfe-local(MinHeight);

0 commit comments

Comments
 (0)