From c230d2e44380915afa665c9ecd77e0f944a79288 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 28 Sep 2020 13:23:46 +0200 Subject: [PATCH] FIX: prevents scrollbar jumping in the emoji picker (#10749) This was mostly due to `content-visibility: auto;` but setting the width/height is also a good practice. --- .../javascripts/pretty-text/addon/emoji.js | 4 +++- app/assets/stylesheets/common/base/emoji.scss | 1 - test/javascripts/acceptance/topic-test.js | 6 +++--- test/javascripts/lib/emoji-test.js | 20 +++++++++---------- test/javascripts/lib/search-test.js | 2 +- test/javascripts/models/topic-test.js | 4 ++-- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/pretty-text/addon/emoji.js b/app/assets/javascripts/pretty-text/addon/emoji.js index 4f588a2f4f5..67a7c2afaf1 100644 --- a/app/assets/javascripts/pretty-text/addon/emoji.js +++ b/app/assets/javascripts/pretty-text/addon/emoji.js @@ -126,7 +126,9 @@ export function performEmojiUnescape(string, opts) { isReplacableInlineEmoji(string, index, inlineEmoji); return url && isReplacable - ? `` : m; diff --git a/app/assets/stylesheets/common/base/emoji.scss b/app/assets/stylesheets/common/base/emoji.scss index 434e94cf3c4..ecbdaab49b8 100644 --- a/app/assets/stylesheets/common/base/emoji.scss +++ b/app/assets/stylesheets/common/base/emoji.scss @@ -65,7 +65,6 @@ sup img.emoji { .section { margin-bottom: 1em; - content-visibility: auto; .trash-recent { background: none; diff --git a/test/javascripts/acceptance/topic-test.js b/test/javascripts/acceptance/topic-test.js index d40bdb26deb..021389f7533 100644 --- a/test/javascripts/acceptance/topic-test.js +++ b/test/javascripts/acceptance/topic-test.js @@ -152,7 +152,7 @@ QUnit.test("Updating the topic title with emojis", async (assert) => { assert.equal( find(".fancy-title").html().trim(), - `emojis title bike blonde_woman:t6`, + `emojis title bike blonde_woman:t6`, "it displays the new title with emojis" ); }); @@ -167,7 +167,7 @@ QUnit.test("Updating the topic title with unicode emojis", async (assert) => { assert.equal( find(".fancy-title").html().trim(), - `emojis title man_farmerpray`, + `emojis title man_farmerpray`, "it displays the new title with escaped unicode emojis" ); }); @@ -185,7 +185,7 @@ QUnit.test( assert.equal( find(".fancy-title").html().trim(), - `Testslightly_smiling_faceTitle`, + `Testslightly_smiling_faceTitle`, "it displays the new title with escaped unicode emojis" ); } diff --git a/test/javascripts/lib/emoji-test.js b/test/javascripts/lib/emoji-test.js index 3a3fed402bf..5fa7ea99861 100644 --- a/test/javascripts/lib/emoji-test.js +++ b/test/javascripts/lib/emoji-test.js @@ -32,12 +32,12 @@ QUnit.test("emojiUnescape", function (assert) { ); testUnescape( "emoticons :)", - `emoticons slight_smile`, + `emoticons slight_smile`, "emoticons are still supported" ); testUnescape( "With emoji :O: :frog: :smile:", - `With emoji O frog smile`, + `With emoji O frog smile`, "title with emoji" ); testUnescape( @@ -47,27 +47,27 @@ QUnit.test("emojiUnescape", function (assert) { ); testUnescape( "(:frog:) :)", - `(frog) slight_smile`, + `(frog) slight_smile`, "non-word characters allowed next to emoji" ); testUnescape( ":smile: hi", - `smile hi`, + `smile hi`, "start of line" ); testUnescape( "hi :smile:", - `hi smile`, + `hi smile`, "end of line" ); testUnescape( "hi :blonde_woman:t4:", - `hi blonde_woman:t4`, + `hi blonde_woman:t4`, "support for skin tones" ); testUnescape( "hi :blonde_woman:t4: :blonde_man:t6:", - `hi blonde_woman:t4 blonde_man:t6`, + `hi blonde_woman:t4 blonde_man:t6`, "support for multiple skin tones" ); testUnescape( @@ -95,7 +95,7 @@ QUnit.test("emojiUnescape", function (assert) { ); testUnescape( "Hello 😊 World", - `Hello blush World`, + `Hello blush World`, "emoji from Unicode emoji" ); testUnescape( @@ -108,7 +108,7 @@ QUnit.test("emojiUnescape", function (assert) { ); testUnescape( "Hello😊World", - `HelloblushWorld`, + `HelloblushWorld`, "emoji from Unicode emoji when inline translation enabled", { enable_inline_emoji_translation: true, @@ -124,7 +124,7 @@ QUnit.test("emojiUnescape", function (assert) { ); testUnescape( "hi:smile:", - `hismile`, + `hismile`, "emoji when inline translation enabled", { enable_inline_emoji_translation: true } ); diff --git a/test/javascripts/lib/search-test.js b/test/javascripts/lib/search-test.js index fadbad9e185..075ebcec944 100644 --- a/test/javascripts/lib/search-test.js +++ b/test/javascripts/lib/search-test.js @@ -32,7 +32,7 @@ QUnit.test("unescapesEmojisInBlurbs", (assert) => { const blurb = results.posts[0].get("blurb"); assert.ok(blurb.indexOf("thinking.png")); - assert.ok(blurb.indexOf(" { assert.equal( topic.get("fancyTitle"), - `smile with all slight_smile the emojis pearpeach`, + `smile with all slight_smile the emojis pearpeach`, "supports emojis" ); }); @@ -159,7 +159,7 @@ QUnit.test("excerpt", (assert) => { assert.equal( topic.get("escapedExcerpt"), - `This is a test topic smile`, + `This is a test topic smile`, "supports emojis" ); });