emoji-picker-element icon indicating copy to clipboard operation
emoji-picker-element copied to clipboard

Add support for CSS ::part()

Open tomayac opened this issue 5 years ago • 10 comments

Your current custom styling section can probably be replaced with CSS ::part(), which has great browser support now.

tomayac avatar Jun 28 '20 17:06 tomayac

Thanks! I saw shadow parts but somehow missed that the browser support was actually pretty good. This might be a nicer API than CSS variables; definitely worth looking into!

nolanlawson avatar Jun 28 '20 19:06 nolanlawson

Ah, it's not supported by iOS <=13.3 though... Maybe this would be a good feature for v2. :)

nolanlawson avatar Jun 28 '20 20:06 nolanlawson

Note that it doesn't have to be the one XOR the other. You can just support both.

tomayac avatar Jun 29 '20 08:06 tomayac

It's a bit tricky to decide which parts to expose. In terms of my own usage, the only "part" that I need access to is the emoji characters themselves (both custom and native), because I convert them to grayscale if the user has enabled grayscale mode (of course, I could just apply grayscale to the whole element, but this has performance impacts, especially for scrolling elements):

https://github.com/nolanlawson/pinafore/blob/7803bdf7975529c07079766112230e18d3e191f1/src/routes/_components/dialog/components/EmojiDialog.html#L78-L83

So I can see the case for adding part="emoji". I'm a bit concerned about the perf hit of adding an extra attribute to every single emoji DOM element, though. But it's definitely possible. I also wonder what other things users would like to have access to, but currently don't.

nolanlawson avatar Sep 13 '20 21:09 nolanlawson

But it's definitely possible. I also wonder what other things users would like to have access to, but currently don't.

For me personally, It would be nice if it was possible to make the categories section scrollable horizontally.

This is the style I'm using

emoji-picker {
width: 100%;
--num-columns: 6;
--border-size: 0;
--outline-size: 0;
--indicator-color: var(--ion-color-primary);
--emoji-size: 2rem;
--indicator-height: 0rem;
}
Untitled

I increased the the emoji size and now I can't see a part of the flag emoji.

Alternatively, it would be nice to have a different variable to change the size of the emojis in the categories section.

ericaig avatar May 27 '21 07:05 ericaig

Hmmmm, I can see two potential solutions:

  • just add overflow-x: auto to the categories section
  • as you say, add a separate variable to change the category size

I'm a bit more in favor of the second one since I think it's a bit unintuitive for users to need to scroll that section.

nolanlawson avatar May 29 '21 19:05 nolanlawson