From 80b61ad79b462b3417b18efbc4b632d9a0d1603b Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 25 Apr 2025 12:28:31 -0400 Subject: [PATCH] MM-61611 Fix layout of emoji picker in mobile view (#30747) * Stop emoji picker header from overlapping tabs * Move emoji picker header above tabs There was also some stuff I could remove because the header will always be visible. * Don't scroll the emoji picker on hover * MM-61611 Fix emoji picker tabs being covered in mobile view * Improve layout of emoji picker and gif picker A lot of the emoji picker was explicitly sized before which made it difficult to make everything responsive in mobile view. Making the emoji picker layout into a flexbox fixed that, but due to the way that it's nested, that was a bit tricky, and it required a couple tricks: 1. The AutoSizer doesn't work if it's placed inside a flexbox container, but you can fix that by putting a div with position: relative in between it and the flexbox parent. That was already the case, but I accidentally removed it while trying to sort out the seemingly excessive nesting. 2. Children of flexbox elements will cause the parent to expand if they don't have min-height/min-width set. That's because the default value for those is 0 outside of flexbox, but it's auto inside of one. This breaks the layout and animation of the skin tone selector in the emoji picker, but that has issues on master as well, so it'll be addressed in the next commit. * Improve and fix opening animation for skin tone selector While this looked worse before in mobile view, it had some weirdness in desktop as well. I ended up rewriting the way that that animation worked so that I could position it correctly in both mobile (where it doesn't cover the input) and desktop (where it does). Notably, that change required: 1. Changing the skin tone selector to wait until its contents are hidden to unmount them so that the position and size could be calculated correctly. 2. Removed the flexbox from the search row and used a margin to make the skin tone button pretend to offset the input. That let us smoothy expand the selector over the input without having the input resize behind it. * Update CSS for positioning emojis and headings in emoji picker --- .../__snapshots__/emoji_picker.test.tsx.snap | 273 +++++++++--------- .../emoji_picker_header.test.tsx.snap | 4 +- .../components/emoji_picker_category_row.tsx | 2 +- .../components/emoji_picker_header.tsx | 2 +- .../components/emoji_picker_skin.tsx | 20 +- .../components/emoji_picker/emoji_picker.tsx | 21 +- .../emoji_picker/emoji_picker_tabs.tsx | 2 +- .../components/gif_picker_search.tsx | 2 +- .../src/components/gif_picker/gif_picker.tsx | 4 +- .../sass/components/_emoji-picker-tabs.scss | 32 ++ .../src/sass/components/_emoticons.scss | 71 ++--- .../channels/src/sass/responsive/_mobile.scss | 61 +--- .../channels/src/sass/utils/_variables.scss | 2 +- webapp/channels/src/utils/utils.tsx | 3 +- 14 files changed, 234 insertions(+), 265 deletions(-) diff --git a/webapp/channels/src/components/emoji_picker/__snapshots__/emoji_picker.test.tsx.snap b/webapp/channels/src/components/emoji_picker/__snapshots__/emoji_picker.test.tsx.snap index 54408bbd68..57d4a1e0c4 100644 --- a/webapp/channels/src/components/emoji_picker/__snapshots__/emoji_picker.test.tsx.snap +++ b/webapp/channels/src/components/emoji_picker/__snapshots__/emoji_picker.test.tsx.snap @@ -3,155 +3,150 @@ exports[`components/emoji_picker/EmojiPicker should match snapshot 1`] = `
+ grinning emoji +
+
- grinning emoji + +
+
+
+
+ +