Interaction

Every way to open the menu, and everything a press might really be.

A finger that moves is scrolling. One that stays put opens the menu. Try both below.

Message number 1
Message number 2
Message number 3
Message number 4
Message number 5
Message number 6
Message number 7
Message number 8
Message number 9
Message number 10
Message number 11
Message number 12
Message number 13
Message number 14
Message number 15
Message number 16
Message number 17
Message number 18
Message number 19
Message number 20
Message number 21
Message number 22
Message number 23
Message number 24

Scroll, or hold a message

Hold to open#

Hold still for 450ms and the item lifts. It works with a finger or the left mouse button. The press is cancelled if you let go early, move more than 8px, or the page scrolls under a resting finger.

A short press is left alone, so the trigger's own onClick still fires on a plain click or tap.

Slide to pick#

Keep holding once the menu is up and slide onto an option. The item under your finger gets data-highlighted, and letting go picks it. Let go over nothing and the menu stays open.

Tap through#

Let go straight after the menu opens, and it stays up. Tap an item to pick it, or anywhere outside to dismiss.

Right-click#

A right-click or Ctrl+click opens the menu right away, in place of the browser's own. The iOS callout and the Android context menu are kept out of the way too.

Keyboard#

The trigger is focusable. If it isn't already, it gets a tabindex.

KeyDoes
Enter, SpaceOn the trigger, opens with focus on the first item. On an item, picks it
ContextMenu, Shift+F10On the trigger, opens with focus on the first item
ArrowDown, ArrowUpMoves between items, and wraps around
Home, EndMoves to the first or last item
EscapeCloses, and returns focus to the trigger

Screen readers#

Holding still isn't an option with a screen reader, so its activation opens the menu straight away, with focus on the first item. The trigger has aria-haspopup and aria-expanded, and the menu and its items have menu and menuitem roles.

Text selection#

With a mouse, dragging across a trigger selects its text as usual, and a press on a selection won't open the menu. On touch, a held finger doesn't start a selection.

Good to know#