Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "lazy loading" for mycodes #3971

Closed
Eldenroot opened this issue May 1, 2020 · 8 comments · Fixed by #4017
Closed

Add "lazy loading" for mycodes #3971

Eldenroot opened this issue May 1, 2020 · 8 comments · Fixed by #4017
Assignees
Labels
b:1.8 Branch: 1.8.x s:resolved Status: Resolved. Solution implemented or scheduled t:optimization Type: Optimization. Improves performance
Milestone

Comments

@Eldenroot
Copy link
Contributor

Use native lazy-loading for web - https://web.dev/native-lazy-loading/#image-loading in mycodes to improve performance.

@euantorano
Copy link
Member

euantorano commented May 1, 2020

Only problem I can see is this:

To prevent the surrounding content from reflowing when a lazy-loaded image is downloaded, make sure to add height and width attributes to the element or specify their values directly in an inline style:

We don't assign width and height attributes as far as I remember, so we would see reflowing. Not a particularly big deal in most cases, but some people might not want that I guess.

I still wish the HTML in the parser was all templates, so that we could easily let people add or remove attributes like loading="lazy" themselves.

@Eldenroot
Copy link
Contributor Author

Yeah, with custom template it would be much easier to add by users.

@euantorano
Copy link
Member

We might get around to that in 1.10 or another big release, it would certainly make life much easier.

@Ben-MyBB
Copy link
Member

@euantorano do you want this added in to 1.8?

@euantorano
Copy link
Member

Yeah, but not 1.8.23.

@euantorano euantorano added b:1.8 Branch: 1.8.x easy-pick Not difficult; good first issue to resolve t:optimization Type: Optimization. Improves performance labels May 23, 2020
@Ben-MyBB Ben-MyBB self-assigned this May 26, 2020
@Ben-MyBB
Copy link
Member

Thanks, I'll give this one a look when I've got my others finished.

@Ben-MyBB
Copy link
Member

Could we not just add the loading="lazy" attribute into the mycode_img template? @euantorano

Just for ease of reference the content of that template being:
<img src="{$url}"{$width}{$height} alt="{$alt}"{$css_align} class="mycode_img" />

@euantorano
Copy link
Member

euantorano commented May 28, 2020 via email

@Ben-MyBB Ben-MyBB added s:review-needed Status: Review Needed. Possible solution submitted and removed easy-pick Not difficult; good first issue to resolve labels May 28, 2020
euantorano added a commit that referenced this issue May 31, 2020
Resolves #3971 - Add "lazy loading" for mycodes
@euantorano euantorano added s:resolved Status: Resolved. Solution implemented or scheduled and removed s:review-needed Status: Review Needed. Possible solution submitted labels May 31, 2020
@Starpaul20 Starpaul20 added this to the 1.8.23 milestone May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b:1.8 Branch: 1.8.x s:resolved Status: Resolved. Solution implemented or scheduled t:optimization Type: Optimization. Improves performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants