Skip to content

Add text fallback for social icons#547

Open
kousu wants to merge 1 commit intoGetPublii:masterfrom
kousu:patch-1
Open

Add text fallback for social icons#547
kousu wants to merge 1 commit intoGetPublii:masterfrom
kousu:patch-1

Conversation

@kousu
Copy link
Copy Markdown

@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

{{/if}}
{{#if @config.custom.socialYoutube}}
<a href="{{@config.custom.socialYoutube}}" aria-label="Youtube">
<desc>Youtube</desc>
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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.

</a>
{{/if}}
{{#if @config.custom.socialYoutube}}
<a href="{{@config.custom.socialYoutube}}" aria-label="Youtube">
Copy link
Copy Markdown

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
Copy Markdown
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?

Copy link
Copy Markdown

@YasharF YasharF Feb 10, 2026

Choose a reason for hiding this comment

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

@kousu kousu The case?

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.

4 participants