Page MenuHomePhabricator

Issue with app store link on Wikipedia.org portal
Closed, ResolvedPublic

Assigned To
None
Authored By
Krinkle
Aug 12 2020, 3:43 AM
Referenced Files
F34099664: image.png
Feb 10 2021, 5:30 PM
F34099706: image.png
Feb 10 2021, 5:30 PM
F34099673: image.png
Feb 10 2021, 5:30 PM
F34099676: image.png
Feb 10 2021, 5:30 PM
F34094343: image.png
Feb 7 2021, 6:37 PM
F34094335: image.png
Feb 7 2021, 6:37 PM
F32066593: Screenshot 2020-08-03 at 23.05.55.png
Aug 12 2020, 3:43 AM

Description

There are two issues with the app store links on https://www.wikipedia.org/, as also noticed and reported by the Chrome Lighthouse report:

  1. Accessibility. The image links have no alt text or tooltip.
  1. Best Practices (Security). The external links are missing one of rel="noopener" or rel="noreferer" to ensure third-party process isolation.

Screenshot 2020-08-03 at 23.05.55.png (596×1 px, 60 KB)

Event Timeline

(I) I've added <title> tag to the svg element, since svg is in the anchor tag, for accessibility.

image.png (1×1 px, 331 KB)

(2) rel="noreferer"
image.png (1×1 px, 334 KB)

Is this correct or shall I add or change anything before I create a patch?

@Sriv26: Hi, apart from the task description here, please upload a patch in Gerrit (see https://www.mediawiki.org/wiki/Gerrit/Tutorial and https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines ) as Gerrit offers a diff view of changes. It's hard to look at IDE screenshots and try to spot code changes somewhere. Thanks!

Change 662137 had a related patch set uploaded (by Sriv26; owner: Sriv26):
[wikimedia/portals@master] change applinks to provide security, accessibility

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

@Aklapper I've created a patch, please review it :)!

Change 662137 merged by jenkins-bot:
[wikimedia/portals@master] change applinks to provide security, accessibility

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

Thanks for the patch @Sriv26 , that takes care of the rel="noreferer" link, but I think what is meant by "1. Accessibility. The image links have no alt text or tooltip." is actually that the links to the Google Play Store and iOS App Store actually don't contain any text.

The markup for these links looks something like this:

<a target="_blank" href="...">
    <span class="sprite svg-badge_google_play_store"></span>
</a>

To solve this issue I think we can add text inside that <span> that says:

"Google Play Store"
"Apple App Store"

We try to localize as many strings as we can on this page, but that process is slightly complex.
I've documented it a bit on this page: https://gerrit.wikimedia.org/r/plugins/gitiles/wikimedia/portals/+/refs/heads/master/docs/architecture/l10n.md
But I'll provide a patch for this ticket that'll demonstrate how we add translatable strings.

I think it's worth adding a title attribute, with the same text, for the a tag too.

@Jdrewniak I've read the documentation and now I have a better understanding of how strings are translated :)
I guess this the Ajax request that you have mentioned in the documentation.

l10nReq = new XMLHttpRequest();
l10nReq.open( 'GET', encodeURI( 'portal/wikipedia.org/assets/l10n/' + primaryLang + '-' + translationsHash + '.json' ), true );

I've added class="jsl10n" data-jsl10n="app-links.url" to the app link cause in function replacel10nText( info ) we are selecting and replacing strings of that class with the translations

<span class="jsl10n" data-jsl10n="app-links.url" class="sprite svg-badge_google_play_store">Google play store</span>

please tell me if I have to add or change anything. :)

Please post text as text (or post code changes as patches in Gerrit) - thanks!

Change 663555 had a related patch set uploaded (by Sriv26; owner: Sriv26):
[wikimedia/portals@master] Add and localize text inside the app links

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

Change 663555 merged by jenkins-bot:
[wikimedia/portals@master] Add and localize text inside the app links

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