Skip to content

Choose the skin tone of an emoji from the keyboard - #31241

Open
rezabakhshilaktasaraei wants to merge 3 commits into
telegramdesktop:devfrom
rezabakhshilaktasaraei:emoji-variants-keyboard
Open

Choose the skin tone of an emoji from the keyboard#31241
rezabakhshilaktasaraei wants to merge 3 commits into
telegramdesktop:devfrom
rezabakhshilaktasaraei:emoji-variants-keyboard

Conversation

@rezabakhshilaktasaraei

@rezabakhshilaktasaraei rezabakhshilaktasaraei commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

On top of #31240 (the emoji panel walked with the keyboard). The skin-tone picker was mouse-only: it comes up right away on the first press of an emoji none of whose variants was ever chosen, and under the button held for a long press (500 ms) after that, while a click inserts with the chosen tone.

  • Enter and Space now do the same on an emoji with variants, with the same delay and the same "chosen before" memory. The picker takes the focus with the shown variant selected; it is a list for a screen reader, named by the emoji, its items the variants (Left/Right, Home/End, Enter or Space chooses — tone saved, emoji inserted, focus back to the field, panel hidden — Escape backs out to the same emoji).
  • An emoji with variants reports itself expandable (expanded while its picker is up) and dispatches the standard showMenu action to open or close it (Dispatch the showMenu action of an expandable painted item desktop-app/lib_ui#365). Platforms whose bridge surfaces the expandable state for list items announce it as collapsed and can open the picker through it; the Windows UIA bridge currently does that for tree items only.

Nothing changes without a screen reader except that Enter/Space in the panel gain the mouse's long-press behaviour. Verified with NVDA.

The emoji panel is a painted grid with no keyboard handling and nothing
for a screen reader to read: opened from the keyboard, it appeared with
no one to talk to, and pressing the "Emoji" button of a field seemed to
do nothing.

Expose every cell shown as an item of a list - named by the emoji
itself, which the screen reader speaks in its own words, described by
the section it is in (the category, or the title of a custom set); the
last cell of a collapsed set is the "+N" that opens it. In screen reader
mode the list takes the focus once the panel is shown and remembers
where it came from; the arrows walk the cells (Up and Down by column,
on into the next section), Home, End and the page keys too. Enter or
Space chooses the emoji, Escape gives up - both return the focus to
where it was and ask the panel to hide, which TabbedSelector::cancelled()
passes on. A selection made from the keyboard survives the mouse
leaving the list. SetFocus and Invoke from the screen reader work the
same way.

The "Emoji" toggle of a field gives the focus to its field before
opening the panel: the fields of a box tell the target of a chosen
emoji apart by the focus, which a toggle pressed from the keyboard held
itself. With the mouse the field has it already.
The variants of an emoji - its skin tones - are picked from a small
panel the mouse brings up over the emoji: right away on the first press
of an emoji none of whose variants was ever chosen, and under the
button held for a long press after that, while a click puts the emoji
in with the tone chosen before. From the keyboard there was no way to
it: the emoji went in with whatever tone it had.

Enter and Space now do on an emoji with variants what the mouse does,
with the same delay: the picker comes up right away for one never
chosen from, under the key held for a long press otherwise, and the
key let go before that chooses. The picker takes the focus, with the
variant shown in the list selected; it is a list for a screen reader,
named by the emoji, its items the variants. Left and Right, Home and
End walk them, Enter or Space chooses - the tone is saved and the
emoji goes in, as a click does, with the focus back where it came from
and the panel done - and Escape backs out to the same emoji in the
list. The picker is raised above the list rather than inside it, so the
list gives the focus in it back the same way as its own, and keeps the
emoji it was on when the picker hides.
An emoji with skin tones and one without sounded the same in the list;
nothing said there was a picker to open. Report such an emoji as
expandable - expanded while its picker is up - so the screen reader
hears it as collapsed and offers to expand it, which opens the picker
as Shift+Enter does; collapsing closes it.

On Windows this needs the UIA ExpandCollapse pattern offered to
expandable elements (Qt patch 0043).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant