Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add full emoji picker for reactions #3554

Merged
merged 16 commits into from
Oct 20, 2019
Merged

Conversation

tulir
Copy link
Member

@tulir tulir commented Oct 13, 2019

Fixes element-hq/element-web#9483

I decided to make a new emoji picker with inspiration from emoji-mart instead of trying to fix emoji-mart itself. Mostly because emoji-mart uses a different outdated emoji dataset than matrix-react-sdk and the code didn't look very nice to work with.

TODO

  • Recently used section
  • Scroll to category when clicking in header bar
  • Underline visible categories in header bar
  • Close emoji picker after selecting
  • Show if emoji is already selected
  • If emoji is already selected, remove reaction when clicking again

Future improvements

  • Skin color picker
  • Add emoji to recently used when clicking on existing reaction too (outside of emoji picker)
  • Use i18n'd emoji names when user is using a language supported by emojibase
  • Improving search matching (e.g. ignoring punctuation and whitespace in search query altogether)

Some previews

image

image

image

Signed-off-by: Tulir Asokan <tulir@maunium.net>
@t3chguy
Copy link
Member

t3chguy commented Oct 13, 2019

looks awesome, the inline svg is a bit out of place for the codebase

@t3chguy
Copy link
Member

t3chguy commented Oct 13, 2019

Would be interesting to wire this up to the composer also :D

@tulir
Copy link
Member Author

tulir commented Oct 14, 2019

the inline svg is a bit out of place for the codebase

Yeah, that was copied from emoji-mart since I didn't know where else to get those icons. I could probably split them into their own files

Would be interesting to wire this up to the composer also :D

That probably requires some design input to figure out where to put it and what to do with the sticker picker

Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
@tulir
Copy link
Member Author

tulir commented Oct 14, 2019

@nadonomy There are some details the design wasn't clear on:

  • Should all skin colors be listed at the same time or should there be some picker where you can change the skin color to use? I think emoji-mart had a picker by default, but the design didn't include space for one. (currently there's no skin tone options at all)
  • Should the scroll area include the search bar, i.e. should scrolling down hide the search bar? (currently it doesn't)
  • Should the underlining in the header only include the top-most visible category, or all visible categories? (current impl is the latter)
  • How many rows of frequently used emojis should be shown at most? (current is 3)
  • How should already emojis that have already been used as reactions be shown? (currently implemented with a green border and slightly transparent emoji)
  • Should the section headers be sticky? (currently they're not)

Also, currently I just approximated the sizes/margins/etc from the images, but if you have pixel precision designs, I can change the implementation to match it.

Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
@nadonomy
Copy link
Contributor

Hey @tulir— apologies I've been 99% afk for the last week or so, but adding this to my list to deep dive into. Do you have this deployed somewhere where I can easily play around with this?

If not, just let me know and I'll set up my dev environment again on this machine.

@tulir
Copy link
Member Author

tulir commented Oct 18, 2019

I should set up some gitlab pipelines to autodeploy riots, but for now I put it on https://riot.mau.dev/emoji-picker

(I've also been using this on my main riot instance at https://matrix.maunium.net, but that has a bunch of other stuff and custom server selector disabled)

@MayeulC
Copy link

MayeulC commented Oct 18, 2019

Does this allow reacting with arbitrary text? It could be useful for polls (though I guess you could use an emoji-based index as well ^^" )

@tulir
Copy link
Member Author

tulir commented Oct 18, 2019

No, but I was planning to add that for myself. If @nadonomy makes a good UI for it, I can integrate it here. Maybe somehow hidden in the search box?

@MurzNN
Copy link
Contributor

MurzNN commented Oct 18, 2019

In test instance widget looks very good, thanks! Will be good to have same widget in edit area for insert emoji to message text via same way! Does it hard to integrate current widget into message composer as separate "second smiley" button at first?

@MayeulC
Copy link

MayeulC commented Oct 18, 2019

Thanks for considering this, I'll try this version out!
I'd have put it in a "text" section at the bottom, under symbols: create a reaction pill with the word typed in the searchbox, that would provide easy feedback regarding the look, and make it obvious that clicking it makes it a reaction. That might not be the best UI though, I don't know?

@ara4n
Copy link
Member

ara4n commented Oct 19, 2019

Functionally speaking (i haven't looked at the code), this is feeling really good - thank you for contributing it. @nadonomy unless you have particularly strong concerns, i'd recommend we just merge it asap and the iterate on it in place. for the record, Nad's official proposed design is:

Screenshot 2019-10-19 at 19 36 46

...so it looks like we're pretty much there already.

The only nastiness I can see from a quick play is that there's a ~1 pixel dead zone between the emoji options (at least on hidpi), so that if you scan the mouse over the available options you get a nasty flicker where it shows the quick selector whenever you jump from one to the next.

Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
@tulir tulir marked this pull request as ready for review October 20, 2019 09:42
@ara4n
Copy link
Member

ara4n commented Oct 20, 2019

this lgtm now, from a fairly high level pass through the code - i think we should merge it asap to see how it feels and then iterate on it further in place. i suggest someone (@jryans, @dbkr, @bwindels) does a retrospective line by line review, but would rather we get this in the hands of users asap.

thanks again @tulir!

@ara4n ara4n merged commit e632b52 into matrix-org:develop Oct 20, 2019
@tulir tulir deleted the emoji-picker branch October 20, 2019 10:24
@MurzNN
Copy link
Contributor

MurzNN commented Oct 21, 2019

Some emoji have extra width and shows not in grid, here is example:
image
And here problem too:
image

@tulir
Copy link
Member Author

tulir commented Oct 21, 2019

@MurzNN That means your emojis are outdated, but not sure how that would happen. Riot should have the up to date (emoji 12 / 2019) twemoji font. I even specifically checked that those new wheelchair emojis worked. Chromium 69 sounds really outdated, maybe update? Anyway, this PR is done, issues should go in riot-web issues, not here.

jryans added a commit that referenced this pull request Nov 7, 2019
This fixes a regression introduced by the full emoji picker which inserted empty
variation selectors in the thumbs up / down quick reactions. Since this makes
them different characters, it would cause us to not aggregate thumbs from web
vs. mobile together.

Regressed by #3554
Fixes element-hq/element-web#11335
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reactions: Add emoji picker as a message action
6 participants