Skip to content

Fade in image embeds on load - #52

Open
sietsev-q42 wants to merge 3 commits into
mainfrom
feature/fade-in-image-embeds-on-load
Open

Fade in image embeds on load#52
sietsev-q42 wants to merge 3 commits into
mainfrom
feature/fade-in-image-embeds-on-load

Conversation

@sietsev-q42

Copy link
Copy Markdown
Collaborator

This PR is initially a conversation starter.
I believe embeds used to fade in with older Micrio versions. This is not the case in v7 and at least not since 5.4.28.

This PR applies the fade in only to the DOM version of an image embed by adding a load event listener and setting data-loaded on the image on the callback.
The "animation" is done in css and configurable with custom properties.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores a fade-in effect for DOM-based image embeds by hiding embed <img> elements until they have finished loading, then revealing them via a CSS transition controlled by custom properties.

Changes:

  • Added global CSS custom properties and opacity/transition rules to fade in embed images once data-loaded is present.
  • Added an image load event handler in the DOM embed path to set data-loaded on the embed <img>.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/embed/image-embeds.css Adds fade-in styling for embed images using opacity + transition and custom properties.
src/embed/embed.ts Adds a load handler on DOM embed <img> creation to set data-loaded.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/embed/embed.ts
Comment on lines +236 to +240
events: {
load: (e: Event) => {
const img = e.target as HTMLImageElement;
img.setAttribute("data-loaded", "");
},
Comment on lines +10 to +17
micrio-image-embeds img {
opacity: 0;
transition: opacity var(--micrio-embed-fade-in-duration) var(--micrio-embed-fade-in-ease);
}

micrio-image-embeds img[data-loaded] {
opacity: 1;
}
@sietsev-q42 sietsev-q42 added bug Something isn't working enhancement New feature or request labels Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants