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 text fallback for social icons #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add text fallback for social icons #547

wants to merge 1 commit into from

Conversation

kousu
Copy link

@kousu kousu commented Aug 18, 2019

This makes the social icons turn into plain text links on screenreaders and text-only browsers like lynx.

Uses this method: https://css-tricks.com/a-complete-guide-to-svg-fallbacks/#fallback-inline-svg-text

<svg>
<use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#pinterest"/>
</svg>
</a>
{{/if}}
{{#if @config.custom.socialYoutube}}
<a href="{{@config.custom.socialYoutube}}" aria-label="Youtube">
<desc>Youtube</desc>
Copy link

@pavelloz pavelloz Sep 19, 2019

Choose a reason for hiding this comment

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

Suggested change
<desc>Youtube</desc>
<desc>YouTube</desc>

Because LinkedIn :)

Copy link
Collaborator

@bobmitro bobmitro Sep 20, 2019

Choose a reason for hiding this comment

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

An <desc> element is used incorrectly, it is a description "component" of SVG file and must be used inside e.g.:
<a href="{{@config.custom.socialPinterest}}" aria-label="Pinterest"> <svg> <desc>Pinterest</desc> <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#pinterest"/> </svg> </a>

Copy link
Author

Choose a reason for hiding this comment

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

Of course you're right. I don't know how I made that mistake. I think I wrote it in the correct way in my own theme, then tried to backport it to the default theme and just didn't notice I was one level off.

<svg>
<use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#vimeo"/>
</svg>
</a>
{{/if}}
{{#if @config.custom.socialPinterest}}
<a href="{{@config.custom.socialPinterest}}" aria-label="Pinterest">
<desc>Pinterest</desc>
<svg>
<use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#pinterest"/>
</svg>
</a>
{{/if}}
{{#if @config.custom.socialYoutube}}
<a href="{{@config.custom.socialYoutube}}" aria-label="Youtube">

Choose a reason for hiding this comment

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

Suggested change
<a href="{{@config.custom.socialYoutube}}" aria-label="Youtube">
<a href="{{@config.custom.socialYoutube}}" aria-label="YouTube">

Copy link
Author

Choose a reason for hiding this comment

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

It's already four spaces indented, just like the rest. Is this a typo?

This makes the social icons turn into plain text links on screenreaders and text-only browsers like lynx.

Uses this method: https://css-tricks.com/a-complete-guide-to-svg-fallbacks/#fallback-inline-svg-text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants