Skip to content

Commit

Permalink
Hide notification element untill the image is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmeeatadobe committed Feb 20, 2025
1 parent 52c5c78 commit 22f92f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libs/blocks/aside/aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,16 @@ function decorateLayout(el) {
if (iconVariant) loadIconography();
iconArea.classList.add(iconClass);
const image = iconArea.querySelector('img');
iconArea.style.aspectRatio = image.width / image.height;
if (image) {
if (image.complete) {
el.style.visibility = 'visible';
} else {
el.style.visibility = 'hidden';
image.addEventListener('load', () => {
el.style.visibility = 'visible';
});
}
}
}
const foregroundImage = foreground.querySelector(':scope > div:not(.text) img')?.closest('div');
const bgImage = el.querySelector(':scope > div:not(.text):not(.foreground) img')?.closest('div');
Expand Down

0 comments on commit 22f92f1

Please sign in to comment.