Comments (4)
This oddly seems to be the right thing to do; if you copy/paste a string with Emoji in it, then the alt text gets used instead of the IMG, so you'd want to use the emoji itself in the ALT text to ensure text round-trips nicely.
But this alone doesn't work too well for accessibility; some screenreaders will read out descriptive text for some symbols, but usually only a handful that they (or the speech engine they use) know about.
For accessibility, turns out that the best thing to do is to use aria-label as descriptive text, which is what Twitter actually do on their own site - view-source on an Tweet such as this one, and you'll get:
<img class="twitter-emoji" src="https://abs.twimg.com/emoji/v1/72x72/1f389.png" draggable="false" alt="🎉" title="Party popper" aria-label="Emoji: Party popper">
So what we'd need is some way to add aria-label to the generated IMGs - and ideally do so in a localization-friendly way. Having a callback option to parse() that can supply aria-label - similar to how the current exclusion callback works - could work here, plus perhaps a set of icon->label maps in different .js files.
from twemoji.
like @BrendanMcK said, it's a copy and paste feature that preserves full intent (no trim, no special treatment, just the initial surrogates pair)
twitter places title and aria-label in the server, which is very nice but at the same time the mapping is huge and I am not sure it's a good idea to add that much extra bandwidth and time to first emoji through a client side solution.
However, everyone could implement such functionality with what this API provides already, a callback, or just an extra "aria" enhancement after replacing emoji, improving all img.emoji
gracefully.
We might provide such mapping as file a part, but that'd be eventually a feature request, not a bug or a change for the alt
attribute.
Best Regards
from twemoji.
Aside: what happens if I copy a string with Emoji in it and paste it inside my content using a browser that doesn't support emoji?
from twemoji.
@afercia you do not loose data, which is the purpose of the copy and paste. Nobody can predict where you are going to paste it, but if the reader on the other side supports emoji natively, it'll see it.
from twemoji.
Related Issues (20)
- bring back twemoji to mobile devices
- FEAT: Improve the ui of footer in the website
- FEAT: Improve the ui of footer in the websit HOT 1
- Fluent Emoji: Twemoji drop-in replacement HOT 3
- about using twemoji HOT 1
- New CDN doesn't seem to work HOT 2
- CDN not needed HOT 1
- Where is the donkey, goose, jellyfish and moose? HOT 10
- How to use twemoji for input field HOT 2
- Grey heart emoji (1FA76.svg) is barely differentiable from the white heart emoji (1F90D.svg)
- Update flag of Martinique HOT 2
- Attribution
- I want to make a Chinese translation HOT 3
- Blue heart (1f499) is different shade than other blue emojis such as blue square, circle, etc. HOT 2
- ![sweating-nervous](https://user-images.githubusercontent.com/2575182/211350030-249c6b1f-a347-4ade-bd40-1ed83629f09f.gif) HOT 1
- Old Twitter Logo (the bird) still not updated (to the X) in twitter.com/account/access HOT 2
- twemoji website doesnt work HOT 2
- CDN links to maxcdn.com are broken HOT 3
- Question: Commercial offline & online usage
- Improper neutralization of special elements used in a command in twemoji shell-quote
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twemoji.