Skip to content

Commit 56f8f24

Browse files
fix(ui5-dialog): fix unwanted animation when opening with large content (#13121)
* fix(ui5-dialog): fix unwanted animation when opening with large content * chore: fix indentation * chore: add the example from the issue * chore: resolve merge conflicts * chore: fix image src
1 parent 34c5537 commit 56f8f24

3 files changed

Lines changed: 80 additions & 0 deletions

File tree

packages/main/src/Popup.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ abstract class Popup extends UI5Element {
369369

370370
this._addOpenedPopup();
371371

372+
this.classList.add("ui5-popup-opening");
373+
setTimeout(() => {
374+
this.classList.remove("ui5-popup-opening");
375+
}, 50);
376+
372377
this.open = true;
373378

374379
// initial focus, if focused element is statically created

packages/main/src/themes/Popup.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@
99

1010
:host(:focus-visible) {
1111
outline: none;
12+
}
13+
14+
:host(.ui5-popup-opening) {
15+
opacity: 0.1;
1216
}

packages/main/test/pages/Dialog.html

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@
9898
<br>
9999
<br>
100100
<ui5-button id="native-dnd-open">Open draggable dialog with native DnD</ui5-button>
101+
<br>
102+
<br>
103+
<ui5-button id="open-big-dynamic-content">Open dynamic dialog with big content</ui5-button>
104+
<br>
105+
<br>
101106
</div>
102107
<ui5-block-layer></ui5-block-layer>
103108

@@ -1159,6 +1164,72 @@
11591164
const data = e.dataTransfer.getData("text");
11601165
dropZone.textContent = `Dropped: ${data}`;
11611166
});
1167+
1168+
document.getElementById("open-big-dynamic-content").addEventListener("click", function () {
1169+
const dialog = document.createElement("ui5-dialog");
1170+
const child1 = `
1171+
<div slot="header" design="Header">
1172+
<h3>Random Title</h3>
1173+
</div>
1174+
`;
1175+
1176+
const child2 = `
1177+
<div>
1178+
<div>
1179+
<div>
1180+
<div>
1181+
<div>
1182+
<img width="60" height="60" src="./img/man_avatar_1.png">
1183+
</div>
1184+
</div>
1185+
<div>
1186+
<div>Contact RANDOM CORP</div>
1187+
<div>Some subtitle</div>
1188+
</div>
1189+
</div>
1190+
</div>
1191+
<form>
1192+
<div>
1193+
<div>
1194+
<p>Subscribe to our newsletter</p>
1195+
<small>No spam, only updates.</small>
1196+
</div>
1197+
</div>
1198+
<div>
1199+
<small>Hint: Use a valid code</small>
1200+
</div>
1201+
<div>Your Info</div>
1202+
<div>
1203+
<div>
1204+
</div>
1205+
<div>
1206+
</div>
1207+
</div>
1208+
<div>Company Info</div>
1209+
<div>
1210+
<div>
1211+
</div>
1212+
<div>
1213+
</div>
1214+
</div>
1215+
<div></div>
1216+
<div>
1217+
<div>
1218+
<span>
1219+
I agree to the random terms and conditions.
1220+
Read Privacy Policy.
1221+
</span>
1222+
</div>
1223+
</div>
1224+
<div></div>
1225+
</form>
1226+
</div>
1227+
`;
1228+
1229+
dialog.innerHTML = child1 + child2;
1230+
document.body.appendChild(dialog);
1231+
dialog.open = true;
1232+
});
11621233
</script>
11631234
</body>
11641235

0 commit comments

Comments
 (0)