Page MenuHomePhabricator

Add lazy loading on Mediawiki powered-by icon
Closed, ResolvedPublic

Description

From https://github.com/wikimedia/mediawiki/pull/110

From b382b7958272ce89cc0cd168a5701835dd3b0a51 Mon Sep 17 00:00:00 2001
From: Ruben Barkow-Kuder <rubo77@users.noreply.github.com>
Date: Sun, 26 Apr 2020 07:52:45 +0200
Subject: [PATCH] Add lazy loading on Mediawiki powered-by icon

This will not load the icon while it is offscreen, only when a user scrolls down, it is loaded
---
 includes/skins/Skin.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index 0b4dc9a..8da2c34 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -910,7 +910,7 @@ abstract class Skin extends ContextSource {
                );
                $text = '<a href="https://www.mediawiki.org/"><img src="' . $url1
                        . '" srcset="' . $url1_5 . ' 1.5x, ' . $url2 . ' 2x" '
-                       . 'height="31" width="88" alt="Powered by MediaWiki" /></a>';
+                       . 'height="31" width="88" alt="Powered by MediaWiki" loading="lazy" /></a>';
                Hooks::run( 'SkinGetPoweredBy', [ &$text, $this ] );
                return $text;
        }
-- 
2.20.1

https://caniuse.com/#search=loading%3D%22lazy%22

Event Timeline

Change 592733 had a related patch set uploaded (by Reedy; owner: Ruben Barkow-Kuder):
[mediawiki/core@master] Add lazy loading on Mediawiki powered-by icon

https://gerrit.wikimedia.org/r/592733

Change 592733 merged by jenkins-bot:
[mediawiki/core@master] Add lazy loading on Mediawiki powered-by icon

https://gerrit.wikimedia.org/r/592733

Krinkle reopened this task as Open.EditedMay 26 2020, 3:39 PM
Krinkle added subscribers: Jdforrester-WMF, Krinkle.

Looks like it didn't work. Or perhaps stopped working.

This is […] not working for the MediaWiki one (from Skin.php):


<ul id="footer-icons" class="noprint"><li id="footer-poweredbyico"><a href="https://www.mediawiki.org/">
		<img src="/static/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" srcset="/static/images/poweredby_mediawiki_132x47.png 1.5x, /static/images/poweredby_mediawiki_176x62.png 2x" width="88" height="31"></a>
	</li>
</ul>

@Jdlrobson Could this be due to footer icons now being structured data? If so, perhaps the above code path is now unused in production.