Post

Aye or Nay? `<input type=emoji>` to trigger the native emoji-picker, allowing you to pick a single emoji.

4 reposts113 likes

I don’t think a new input type is needed for emoji input. Modern keyboards already supports emojis to use in a text input. We should just able to hint a keyboard preference like we do for numeric inputs. Using inputmode makes more sense.

I'm wondering what the use case would be? Some kind of reaction... But if you want to limit to certain emoji only, then a custom select might be a better fit? I cannot make it make sense for inserting emoji in text content though. So right now, I'd go with nay.

For limited options, the custom select would be a good solution indeed. The thing I am thinking of is this one right here: on top of a set of predefined options, you can also chose _any_ emoji. Instead of having to build your own emoji picker, it’d be nice to just trigger the native one.

Or maybe a new emoji picker attribute or something... My point being that it should not just be about the picker but also contain the logic to insert the selected emoji without javascript

In both case, custom select or emoji input in your example... Isn't the bigger complexity to actually get the selected emoji and insert it at the right place in the text box? I wonder if a new value for the inputmode attribute with a natively implemented picker wouldn't make more sense? 🤔

<input inputmode=emoji pattern="\p{RGI_Emoji}"> 😎 Kidding. An <input type=emoji> would mean we could implement all those "reaction pickers" from slack or discord using .showPicker() right? (well, of course, slack and discord have custom emojis so they would still use their own pickers anyway)

i like the idea, but why not a variant of type=text? it does share other possible concerns, like min/max attributes (might want to pick several emoji)

Also it would fallback to a text input in unsupporting browsers which is quite different to what is desired imo. Tbh I think a window.showEmojiPicker() is probably a good first step anyway. Give people a JS way to invoke it and use the selected character somehow?

We often want to insert the chosen emoji into a textarea or something, so the picker itself being an input feels wrong regardless. <button emojipicker> is perhaps a better design for progressive enhancement?

Mnay... As in "maybe tilting to nay". I believe there are a lot more important things we need at the moment. The use case seems limited (maybe web versions of chats?), or am I missing something?

This is the use case I am thinking of: a reaction picker with a predefined predefined set of options (custom select, or a popover) that also allows you to chose _any_ emoji on top. Clicking that + would trigger the emoji picker.

When writing in some more or less fancy ContentEditable, having a separate input element for inserting an emoji into the ContentEditable feels counterproductive. A method on the navigator object or a button command could be options for toggling the dialog.

Yes! But a lot of corner cases to work out, like ZWJ on one platform that aren't supported on another, so a single emoji can become several. Like 👨🏻‍👩🏿‍👦🏽 might be 1, 3, 6 or 11 emojis depending on the platform support.

That would all be taken care of because `<input type=emoji>` would trigger the native emoji picker which would be responsible for that.

I think the pain is on the render side - I add the complex ZWJ emoji on a platform that does support it, then it gets viewed on a platform that doesn't. Does it show its best guess? Does it show ZWJ placeholders? What does it POST on resubmit? All solvable, just... messy.

For instance, I input 🏳️‍🌈 Someone on an unsupported platform else sees 🏳️🌈, but the input actually holds "🏳️ZWJ🌈" When they submit the form, do they send the ZWJ? If they interact with it does it become "🏳️"?

I imagine it'll be a button-like affordance like [type="submit"], right? Immediately thinking that would be useful in a rich text editor context

Some considerations: - Reactions, or e.g. GitHub's comment box textarea allows emoji (picker opens with `:`). So maybe primitives to enumerate emoji would be better? - Many sites (slack, masto, github) have custom emoji. How do they get displayed? Slack can't use private space due to size.

AFIK many reaction pickers offer a set of fixed choices, and can allow picking an emoji from the whole set. See this Google Chat screenshot. I think that + icon there could be an `<input type=emoji>`, triggering the native emoji picker. I think custom emoji are a related but separate problem.

YES PLEASE YES Emojis are *SO DIFFICULT* to get right - and there's no canonical way to ask "what emojis are natively available on this platform?". The amount of implementation detail in userland solutions is *absurd*. Modifiers such as skin tones! Platform support! keyword searches! 1/🧵

I made a whole "emoji-platform-data" library to try to track what emojis are available in each platform, and what their metadata is. There are *SO MANY ODDITIES* between them. E.g., take 🧮. If you search "math" should that come up? * Fluent (MSFT): no * Gemoji (GitHub): no * Twemoji (X): yes 2/🧵

Plus, consider the difficulty of trying to get the right emojis at all across different platforms. We couldn't even find out how to access the Mac data at all (in the last few macOS versions), let alone make a system to get the right emojis for the user's OS! github.com/JoshuaKGoldb... 3/🧵

github.com🚀 Feature: Add emojis from macOS · Issue #5 · JoshuaKGoldberg/emoji-platform-dataBug Report Checklist I have pulled the latest main branch of the repository. I have searched for related issues and found none that matched my issue. Overview macOS has its own emoji picker with a ...

github.com/JoshuaKGoldb... has the list of "we'd like to get data for this platform but don't have it yet". There are so many platforms! Note that "macOS" and "Windows" are on that list. Which is wild. There's no good userland way that I could find to get that statically?! 4/🧵

github.com🚀 Feature: Add emojis from macOS · Issue #5 · JoshuaKGoldberg/emoji-platform-dataBug Report Checklist I have pulled the latest main branch of the repository. I have searched for related issues and found none that matched my issue. Overview macOS has its own emoji picker with a ...

Potentially. I'm mainly thinking of a text input whereby you can easily add multiple emojis (not unlike Bluesky's UX). Maybe we can compose an `<input type="text">` with an `<input type="emoji">` in the correct manner.

Hmm. I try to think of a situation where picking an emoji is its own input instead of just part of an text input or text area. Sound more like command (invoker) for a textarea element.

The UI I’m thinking of is this one here, in which you provide your own reaction widget with some default options, but want to allow all emoji reactions by clicking the + button. Upon clicking that button, the native emoji picker would get shown.

Yes, but: Make sure that the site can customize the font so you're actually picking emoji that look like what will be inserted. Don't require an input so sites can implement popup shortcuts, like :smile:

What I’m mainly looking after with my thought, is a way to show the native emoji picker from within a webpage. This could as well be a call to something like `window.showEmojiPicker()`, but I’m more fond of an input because then you have `change` events and such.

I suppose you have a sort of reaction UI in mind, right? Where I press on the emoji icon (or the emoji type input), select an emoji, and then that's my reaction? Then the input would have to specify which emojis are allowed. Besides, this scenario doesn't treat emojis as text but instead enums.

Kinda like that. The UI I’m thinking of is something like this here, in which there is a list of pre-defined recations, but hitting that + icon allows you to pick a custom one. Clicking the + would trigger the emoji picker.

...and then? Will it be an input where I can only pick and have emojis? Will it function like a file picker where I picked an emoji and now I... reference it somewhere? The issue with this is that emoji are just special characters. They are a pat of a larger text, and we've got inputs for that.

I assume this would work the same as `<input type=number maxlength=1>` where the input limits both the available character range and the number of characters.

It could on mobile, much like the number input, but that's more up to the browser's implementation. It could also be something akin to <input type="color">.