diff --git a/lib/pretty_text/shims.js b/lib/pretty_text/shims.js index 9631d260f8a..680177914c9 100644 --- a/lib/pretty_text/shims.js +++ b/lib/pretty_text/shims.js @@ -20,6 +20,11 @@ __setUnicode = function(replacements) { } text = text.replace(m[0], replacement); } + + // fixes Safari VARIATION SELECTOR-16 issue with some emojis + // https://meta.discourse.org/t/emojis-selected-on-ios-displaying-additional-rectangles/86132 + text = text.replace(/\ufe0f/g, ''); + return text; }; }; diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb index d115a69bfff..dd68a554fca 100644 --- a/spec/components/pretty_text_spec.rb +++ b/spec/components/pretty_text_spec.rb @@ -797,6 +797,10 @@ describe PrettyText do expect(PrettyText.cook("hello 👩🏾‍🎓")).to eq("

hello \":woman_student:t5:\"

") expect(PrettyText.cook("hello 🤷‍♀️")).to eq("

hello \":woman_shrugging:\"

") end + + it "correctly strips VARIATION SELECTOR-16 character (ufe0f) from some emojis" do + expect(PrettyText.cook("❤️💣")).to match(/]+bomb[^>]+>/) + end end describe "custom emoji" do