Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 80203ef

Browse files
committedAug 5, 2024··
newer emoji may not be in emoji-essential, so we need to be extra defensive
11ty/tugboat#9 (comment)
1 parent c87e372 commit 80203ef

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎_components/accessible-emoji.webc

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@
1010
* `⊛ ` into names, so filtering here.
1111
* https://github.com/WebReflection/emoji-essential/issues/1
1212
*
13+
* Newer emoji may not be in emoji-essential, so we need to be extra defensive
14+
*
1315
* Learn more:
1416
* - https://kittygiraudel.com/2021/01/02/accessible-emojis-with-11ty/
1517
* - https://tink.uk/accessible-emoji/
1618
* - https://adrianroselli.com/2016/12/accessible-emoji-tweaked.html
1719
*/
1820
let label = "";
19-
alt ? label = alt.toString()
20-
: label = emojiShortName(emoji).toString().replace("⊛ ", "");
21+
if (alt && typeof alt === 'string') {
22+
label = alt;
23+
} else if (typeof emoji === 'string' && typeof alt === 'undefined') {
24+
shortName = emojiShortName(emoji);
25+
if (typeof shortName !== "undefined") {
26+
label = shortName.replace("⊛ ", "");
27+
}
28+
}
2129
`<span role="img" aria-label="${label}">${emoji}</span>`
2230
</script>

0 commit comments

Comments
 (0)
This repository has been archived.