The item, the order and the keys. A menu is a short list of things to do to something, opened from a button and gone after one choice; this part settles what each item is made of, how wide the list is, where the dangerous verb goes, how an item that can't be used says why, how submenus and checkable items behave, the menu button and the split button, the context menu, and the keyboard that has to work for all of it.
A menu is a short list of actions on one target, opened from a trigger and gone after one choice. Three other things look the same when they are open, a white panel under a button, and each needs a different control: a select holds a value, a navigation dropdown goes to places, and a popover holds anything else. The first decision is which of the four it is, and the test is what the trigger says after the choice.
| Surface | Holds | A choice | The trigger after |
|---|---|---|---|
| Menu | Actions on one target | Does it now; the menu closes | Its own name, unchanged |
| Select | The values of one field | Sets the field; the form sends it later | The chosen value (Select I) |
| Navigation | Places, each with an address | Goes there; the URL changes | Where you are, marked (Navigation) |
| Popover | A form, a detail card, a picker | Nothing until Apply, or nothing at all | Its name, sometimes a count (Popover I) |
A menu does; a select remembers. The difference is said once and it settles most arguments. Choosing "UPS Ground" from the Ship via list does nothing to the order yet: it fills a field, the field shows it, and the form sends it when the buyer presses the form's button. Choosing "Print packing slip" prints, now, and leaves nothing behind in the trigger, which still says Actions. Build the field as a menu and the value has nowhere to live; build the actions as a select and every action has to be "selected" and then reset to a placeholder, so the control lies about its state for the moment between. The ARIA roles follow the same line, listbox and option for one, menu and menuitem for the other, and so do the keys: a listbox opens on the current value, a menu on its first item.
A navigation list is links, and a popover is everything else. A dropdown of places in the top bar has addresses, so its items are links that can be opened in a new tab, and it marks the current place; a menu has neither, and a menu item that quietly navigates is section VII's failure. A filter with three checkboxes and Apply is a form in a popover (Popover I §IX), because a menu closes after one choice and the second tick would be lost. The wrong frame is the one most component libraries invite: one "Dropdown" with a button and a panel, used four ways, so the four lose the four things that made them different. It ships because it is one component instead of four. The cost is paid in the select, where nothing shows what was chosen, and in the filter, where each tick closes the panel.
The boundaries, stated once. Popover I made the menu one of its four content classes and gave it its surface: level 2, the hairline, md 8, the 4 inset, the anchor gap and light dismiss. Tables I §IX put the ⋯ menu on the row and settled two visible actions with the rest in words. Select I owns the listbox, Navigation the menu bar and the site's dropdowns, and Search & Autocomplete (planned) the command palette, which is a search over actions rather than a list of them. This page has no colour in it, by rule: the destructive item is told by its place, the separator above it and its word, never by a red label, and Color (planned, written last) may add a hue on top of that but never instead of it.
An item is a 32 row in the UI voice, 13/20, its text 12 from the menu's hairline: 4 of the menu's inset and 8 of the item's own. Before the label sits a 16 slot with an 8 gap, used by every item or by none; after it a trailing column holds a shortcut in the mono or a chevron, pushed to the end. Density changes the row, 28 compact at 12/16 and 40 comfortable at 14/20, and nothing else moves.
Thirty-two because a menu is UI. The row is the table's row, the listbox option's (Select I §VI) and the row of Tables I §IX's ⋯ menu, so a menu opened from a table reads as part of the same product. The 13/20 text is centred with 6 above and 6 below, (32 − 20) / 2. Compact takes the product's compact voice, 12/16 in a 28 row, and keeps the 6; comfortable takes 14/20 in a 40 row and widens the menu to 216, because the longer type needs it. The density posture is decided once for the product, and a menu follows it rather than choosing its own. On touch the row is 44 (section XIV).
One text rail, so the leading slot is all or nothing. The label starts 12 from the hairline, where Popover I §IX put it. With a 16 icon and an 8 gap the rail moves to 36, and it must move for every item at once: the mixed list puts labels at 12 and 36, and the menu reads as two lists interleaved, which the readout measures. Icons I §IX gives icons to no menu item by default and to every item only in a short list of actions everyone knows on sight, such as cut, copy, paste and delete, which is the list drawn here. The one other use of the slot is the check of section VIII, which is state rather than decoration and reserves the slot for the whole menu.
The trailing column is for the shortcut or the chevron, never both. A shortcut is set in IBM Plex Mono at 11, muted, its end 12 from the hairline, with at least 16 between it and the longest label, so the column reads as a second field. The mono keeps ⌘C and ⌘V the same width as each other, the job Type II §VI gives fixed-width figures. Use the platform's glyphs, ⌘ ⇧ ⌥ on a Mac and Ctrl+Shift elsewhere, never both, and show a shortcut only if it works from the page with the menu closed: the menu is where users learn the keyboard, which Popover I §VIII said of the tooltip, and a shortcut that only works inside the menu teaches nothing. The chevron of a submenu takes the same column and the same muted ink.
A menu is 200 wide unless its longest item needs more, and then it steps by 40 to 240, 280 and at most 320; it is never narrower than 160, nor than its trigger. The longest label sets the width, and the trigger sets only a floor. A label that still won't fit in 320 is a name someone typed, and it truncates at the end with the whole name in a tooltip; an item never wraps.
Two hundred, because most verbs are short. An action label is two to four words, "Print packing slip" or "Copy PO number", and 200 holds about twenty-two characters of 13px DM Sans with a shortcut beside them. One default width means the menus of a product line up from screen to screen, and the ⋯ menu of Tables I §IX is the same 200. A menu whose items need more steps up by 40, never to an arbitrary number, so a 233 menu and a 241 menu don't sit one above the other on the same screen; the stepped width in the specimen is computed from the measured labels, not typed in.
The trigger is a floor, never the width. Popover I §IX made a menu at least as wide as its anchor, and that is all the anchor gets to say. A listbox matches its field's width because it is that field's list of values (Popover I §III); a menu is not the button's values, and sizing it to a 96px "Move to" button cuts every warehouse to "Dayton Distr…". The same reasoning is Tables I §IV's long header: the thing above never sets the width of the thing below.
Never wrap. A two-line item breaks the one regular thing about a menu, its 32 rows, and once rows vary in height the eye can no longer tell where one item ends and the next starts, the separators of section IV stop meaning anything, and type-ahead lands on a row whose first word is on another line. The wrapped frame is what a team gets by setting max-width and leaving white-space alone, and it looks acceptable with one long label and broken with three.
Truncate the typed name, rewrite the verb. The only label that may be cut is one the product didn't write, a warehouse, a saved view, a customer, and then at the end, with the whole name in a tooltip that keyboard focus also opens, the last resort Type II §VII allows for names read from the start. If it is the product's own verb that won't fit in 320, the verb is too long: "Generate and download the packing slip as a PDF" is "Download packing slip".
Separators gather verbs that act on the same part of the target, a hairline with 4 above and 4 below. A menu of more than five items has two to four groups; one of five or fewer usually needs none. A group label is added only when the groups aren't obvious from their verbs, and a separator between every item is a menu of groups of one, which is no grouping at all.
Group by what the verb touches. The vendor's ⋯ menu has four kinds of verb: the record itself (edit, duplicate), the person at the vendor (email, copy the phone, copy the address), the vendor's purchase orders, and the record's life (archive, delete). Each group is two or three items, few enough to be taken in at a glance, and the separators let the eye skip a whole group whose subject isn't the one it came for. Without them the nine items are one list read top to bottom every time; it isn't wrong at five items and it is slow at nine.
Order within a group by use, and the groups by distance from the record. The verbs a buyer uses most come first, in the first group, so they sit under the pointer when the menu opens; the groups then move outward from the record to its contacts, to its related records, to its lifecycle, which ends the menu. The order is fixed: a menu that reorders itself by recent use breaks the hand's memory of where things are, and Apple's menu guidance asks for the same stability. A separator is the hairline the table's rows use, 1px at .10, with 4 above and 4 below, so a group boundary costs 9px.
A group label earns its place by removing a word from every item under it. "Contact · Marcus Bell" says whose phone and whose address, which the bare verbs didn't; "Purchasing" is weaker, since "New purchase order" already said it, and in practice one or two labels in a menu is the most that pay. A label is 11/16 in the muted ink, 28 tall, inert: it never takes focus, type-ahead skips it, and it is the group's accessible name rather than an item, the rule Select I §VII set for anything in a list that isn't an option. The wrong frame is the team that liked the separators: one between every item adds 64px, splits the contact verbs from each other, and leaves nothing for a real boundary to say.
The destructive item goes last, after a separator, and names what it destroys: "Delete vendor…", never "Delete". It opens a confirmation when the loss can't be undone, and then its label ends in an ellipsis; a reversible one acts at once and offers Undo. It is set in the same ink as every other item, because its place, its separator and its word already say what it is, and it never sits next to the item the user picks most.
Last, because the first items are the ones that get hit. A menu opens with the pointer at its top, a hand that has opened this menu a hundred times moves to the second item before the eyes arrive, and a slip of one row is the commonest error a menu has. Delete beside "Open vendor" turns that slip into a deleted vendor. Among the routine verbs it is no better: it is found by reading, and it is one row from Edit. At the end, after a separator, it is the farthest item from the default and the only one past a boundary that says "the record's life". The keyboard gives one more reason: arrows wrap (section XIII), so ArrowUp from the first item lands on the last, and the last item must never be one that acts at once.
The word names the object. In a vendor's menu "Delete" could mean the vendor, the contact in the group above, or the price agreement the menu was opened from; "Delete vendor…" can't. Modal I §X puts the object and its count in the dialog's title and on its verb button, and the menu item is the first place that name appears. Reversible lifecycle verbs, "Archive vendor" here, act at once and offer Undo in a toast, which Feedback I §VI prefers to a question; the irreversible one asks, ends in the ellipsis that says it will ask (section VII), and gives Cancel the focus. A confirmation on every item trains people to press through it, which is why reversible verbs don't get one.
No red, here or later. The item is told apart by three things that survive greyscale, a screen reader and a printout: it is last, it is past a separator, and its word is "Delete". A red label is the usual fourth signal and, used alone, the usual only one, which fails the colour-blind buyer and the dark-mode screen where red text on dark grey drops below 4.5:1. Carbon's overflow menu puts its danger item last behind a divider before it adds the colour, and Popover I §IX already said the same three things. When Color adds a hue it will sit on top of these, never replace them.
An item the user can't use right now stays in the menu at .45 and says why, in a tooltip on hover and on keyboard focus, or as a second line on touch. An item that can never apply to this object is left out. Greying an item without a reason makes the user guess what to change, and hiding an item they expect makes them hunt for it in every other menu on the screen.
Open Actions and rest on Receive items, or arrow down to it: the reason arrives after 400ms either way.
Present at .45, focusable, the reason on hover and focus · Right Greyed, skipped by the keys, no reason · Wrong Removed while it doesn't apply · Wrong: the clerk hunts for itPresent and greyed means "not now"; absent means "never here". Receiving is something every goods PO gets eventually, so on one that hasn't shipped the item stays, greyed, and says when it will apply. On a service PO, a freight invoice with nothing to receive, the item never applies and isn't there. Permissions follow the same line: a clerk who will never approve anything doesn't see Approve, while Priya, whose limit is $2,500, sees it greyed on this $4,812.50 order with the name of the person who can. The hidden frame is what a team ships when it treats the menu as "what you can do now": the receiving clerk who was told to receive PO-24817 opens the menu, doesn't find the verb, and opens every other menu on the screen looking for it.
The reason is a tooltip that keyboard focus also opens. A disabled item is aria-disabled="true", not removed from the arrow-key order, which the WAI-ARIA practices recommend for menu items so that a keyboard user can find out what exists. This is the one place this page parts from Select I §IX, whose disabled options are skipped: an option's reason fits in a trailing note, while an action's reason is a sentence, and a sentence needs a tooltip the item can only carry if it takes focus, the fix Popover I §I gave the disabled button. The tooltip sits 4 from the menu's edge, centred on the item, after the 400ms of the warm state, in two lines at most. On touch there are no tooltips, so the sheet of section XIV sets the reason as a second line under the label.
.45 is a dimmed label, not a hidden one. The label and its shortcut take .45 of the item's ink, which the readout measures against the surface: low enough to read as unavailable at a glance, high enough to read the word, which is the point. The highlight still lands on the item when the keys or the pointer reach it, at full strength, so the user can see where they are while they read why they can't go further. A greyed item with no reason is the frame most products ship; it is honest about the state and silent about the cause, and the buyer is left to work out whether it is the order's status, their role or a bug.
An item's ending says what happens next. An ellipsis means a dialog or a drawer will ask for something before the action happens; a chevron opens a submenu; ↗ leaves for another tab; no ending means the item does its job and the menu closes. An item that takes the user to another page says where in its words, "View in receiving log", and never looks like one that acts in place.
The ellipsis promises that nothing happens yet. It is the oldest convention in menus, and Apple's guidance still states it: an item that needs more from the user before it can finish ends in "…". It is the cheapest reassurance a menu can give, because it tells a cautious user they may click "Cancel purchase order…" just to see what it would do. It goes on items that ask (a dialog with fields, a drawer that edits, the confirmation of Modal I §X) and not on items that only show something: "Open purchase order" opens and asks nothing. Write the single character, U+2026, not three full stops.
The chevron opens, ↗ leaves. The trailing column holds a 16 glyph in the muted ink for the two endings that are glyphs, which are two of the three trailing uses Icons I §VIII allows: a menu, and an external link. The chevron is reserved for a submenu, so it never appears on an item that opens a dialog; ↗ is reserved for a new tab or another product, so the user knows this screen, with its scroll and its selection, will still be here.
An item that navigates says where. A menu acts on its target, and an item that silently replaces the screen loses the user's place: the scroll position, the selection, a filter half made. If an item must leave, its word names the destination, "View in receiving log" rather than "Receiving", and it is a real link with role="menuitem" on an <a href>, so a middle-click opens it in a tab like every other link. In the wrong frame every item looks the same and five of the eight do five different things; a team ships it because each item was added by a different feature, and the user learns the menu by being surprised once per item.
A checkable item is a command that shows a state. Its check sits in the leading 16 slot, which every item in the menu then reserves so the labels stay on one rail; choices that exclude each other are a radio group under a group label, with a dot in the same slot. The menu closes after the click, so the state has to show somewhere that stays: the trigger names it when the menu holds one setting, and the view itself shows it when there are several.
| Order | Customer | Ship-to | Ordered | Ships | Total | Status |
|---|---|---|---|---|---|---|
| SO-58214 | Miami Valley Steel | Springfield, OH | Oct 15 | Oct 17 | $3,918.40 | Open |
| SO-58213 | Brightwell Packaging | Columbus, OH | Oct 15 | Oct 16 | $1,240.00 | Shipped |
| SO-58211 | Ortega Mechanical | Dayton, OH | Oct 14 | Oct 18 | $612.75 | Cancelled |
| SO-58209 | Whitfield Builders | Kettering, OH | Oct 14 | Oct 15 | $8,402.10 | Shipped |
| SO-58206 | Bell & Sons HVAC | Xenia, OH | Oct 13 | Oct 17 | $2,077.00 | Open |
| SO-58204 | Natarajan Labs | Beavercreek, OH | Oct 12 | Oct 14 | $455.20 | Shipped |
A check, not a box. Checkbox I §XI settled this: a menu closes on activation, so its checkable items are commands that also show a state, "✓ Show cancelled orders", and a box makes the menu look like a form waiting to be submitted. The boxed frame is what a team gets by reusing the checkbox component inside the menu, and it invites the user to tick three boxes and look for the Apply that isn't there. The label states what is true when checked, the on-state label: "Show cancelled orders", never "Hide…" or "Toggle…". The roles are menuitemcheckbox and menuitemradio with aria-checked, so the state is read aloud as well as drawn.
The slot is reserved for the whole menu. This is the one reservation the leading column of section II allows, because a check is state and not decoration: every item keeps the 16 slot and its 8 gap whether checked or not, so the labels hold one rail at 36 and the eye can scan the slot alone to find what is on. Leave the slot to the checked items only and the label jumps 24 to the right when it is checked, which the third frame measures, and the column of labels zigzags with the state. A radio group sits under its group label, 11/16 in the muted ink, as role="group" named by that label, with a 6 dot in the same slot; the label is what tells "Compact" in Row height from a "Compact" anywhere else.
The result shows where it stays. A menu that holds one setting names it in the trigger, "Sort: Ship date", because after the menu closes the trigger is the only place left to say it; the column's own sort arrow agrees with it (Tables I §VI). A menu of several settings keeps its name, View, and lets the view show each one: the ship-to column appears, the rows get shorter, and a setting that hides data says so in the count, "1 cancelled hidden", so nobody wonders where an order went. A user who wants to set four things at once has outgrown the menu; that is a popover form with Apply (Popover I §IX).
A submenu holds a list the parent item can't: it opens after 150ms of hover or on ArrowRight, closes on ArrowLeft, and stays open while the pointer crosses the triangle between where it left the parent item and the submenu's near edge. A menu has one level of them at most. Fewer than four children, or a group a label could name, is flattened into the parent instead.
Open Stock, rest on Move to warehouse, then go straight for Louisville on the diagonal. Then try the same move with "Opens on contact".
150ms of intent, the triangle, Export flattened into two items · Right Opens on contact, closes on the next item, two-item submenus · Wrong A submenu inside a submenu · Wrong: three columns to crossA submenu is a verb with a list of objects. "Move to warehouse" is one action on five places, and five rows of warehouses would swamp the stock menu they were put in; the submenu keeps them one level away. That is its only good use. Its cost is a second movement, sideways and then down, and a second surface to keep open, so a submenu has to hold enough to be worth both: four or more children. "Export › CSV, PDF" is two clicks and a diagonal for what "Export as CSV" and "Export as PDF" do in one, and the right frame flattens them into the parent.
Hover intent, then the triangle. A submenu that opens on contact flickers open under every pointer passing down the list, and closes the moment the pointer, heading for it, crosses the next item on the diagonal. Waiting 150ms, the fast step of the duration scale, is long enough to pass through and short enough not to feel late. The triangle is the fix for the diagonal, from Ben Kamens' account of Amazon's dropdown, which Navigation already asks of any hover menu: while the pointer moves inside the triangle from its last point on the parent item to the submenu's near corners, the items it crosses are ignored, for up to 300ms. The specimen draws it; turn it on and watch the shape follow the pointer.
The keys and the place. ArrowRight, Enter or Space on the parent opens the submenu with its first item focused; ArrowLeft or Escape closes it and puts focus back on the parent item, which keeps its highlight while its submenu is open. The submenu's first item sits level with its parent, its edge on the parent menu's edge, and it flips to the other side when it would leave the viewport, by the collision order. One level is the limit. A second goes three columns across, the third column usually flips back over the first, and the user is steering through a maze to reach an aisle; a choice that deep is a dialog with a picker in it, "Move to…", where the user can see all three levels at once.
A button that only opens a menu says so with a trailing chevron and does nothing else. A split button is two buttons in one outline: the larger half does the default at once, and the 32 chevron half opens the alternatives, which are the same act done differently. Use a split button when one variation is chosen most of the time; use a menu button when no item is the obvious default; and never split a button whose default can't be undone.
The chevron is a promise that a menu comes next. A trailing chevron is one of the three trailing uses Icons I §VIII allows, and Buttons §VIII already gave trailing icons to expansion. On a menu button it means "this opens a list and does nothing yet", and the button carries aria-haspopup="menu" and aria-expanded so a screen reader says the same. The wrong frame's Export has the chevron and downloads a CSV on click: the user who wanted a PDF has a file they didn't ask for, and learns to distrust every chevron in the product. The other half of that frame is Print as a menu button holding "Packing slip" first: the action the warehouse does forty times a day now takes two clicks every time.
A split button is a default and its variations. Printing the packing slip is nine prints in ten, and the pick list, the bin labels and the PO itself are the same verb on other paper, so they go behind the chevron half and the slip stays one click. The two halves are two buttons, two tab stops and two names: "Print packing slip" and "More print options". The chevron half is 32 wide, the icon-only target of Icons I §VII, divided from the default by the button's own edge tone, and its menu starts on the split's start edge and is at least as wide as the whole split, since the whole split is its anchor. Carbon ships the same pair as its menu button and combo button, and keeps the overflow menu, ⋯, for actions with no label in the toolbar.
Never split a verb that can't be undone, and never fill the chevron with strangers. The large half of a split is the easiest thing in the toolbar to press, so its default must be safe to press by accident; a split with Send or Publish as its default puts the irreversible verb exactly where a routine one belongs, which Grid II §V ruled out for every page. The third frame is the split as a drawer: its menu holds Duplicate, Email and Cancel, which have nothing to do with printing, because the toolbar had no other place for them. Those are the ⋯ menu's, and the split's menu holds only prints.
A context menu is the row's ⋯ menu opened from somewhere else. Right-click or long-press on a row opens the same items in the same order at the pointer, never more and never fewer; it opens with its corner on the pointer and flips to the other side of it when it won't fit. Keyboard users reach the same menu from the ⋯ button, Shift+F10 or the menu key, so nothing lives only behind the right button.
| PO | Vendor | Ordered | Total | Status | |
|---|---|---|---|---|---|
| PO-24817 | Harlan Fastener Co. | Oct 14 | $4,812.50 | Ordered | |
| PO-24816 | Miami Valley Steel | Oct 13 | $12,940.00 | Received | |
| PO-24815 | Brightwell Packaging | Oct 13 | $1,086.30 | Partly received | |
| PO-24812 | Ohio Valley Abrasives | Oct 10 | $648.00 | Ordered | |
| PO-24809 | Gem City Electrical | Oct 9 | $2,315.75 | Received |
Right-click a row, or focus one and press Shift+F10. Then open the same row's ⋯ and compare.
Right-click, Shift+F10 and ⋯ open one menu · Right Four actions only on right-click · WrongOne menu, three ways to open it. The ⋯ button of Tables I §IX is the visible way in; right-click is the fast way for a buyer who has learnt it; long-press is the same on touch. All three open the same element with the same items in the same order, and the specimen counts them. The wrong frame is a context menu with four extra actions, merge, assign, rush and copy as CSV, which is what a team ships when power features are added "for people who right-click": nothing on the screen says they exist, touch users and most keyboard users never find them, and the buyer who learnt "Merge" by right-click opens ⋯ one day and decides it was removed. Fewer items is the mirror failure, a context menu trimmed to "the common ones", and it breaks the hand's memory of where Cancel was.
At the pointer, on the row that was clicked. The pointer is the anchor and it is already above the menu, so there is no gap: the menu's top-start corner is on the pointer. When it won't fit it takes the next step of the collision order and opens up or to the start of the pointer, never over it. The row it acts on is drawn in the highlight while the menu is open, so the buyer can see which PO "Cancel" will cancel; with rows selected, a right-click on one of them acts on the selection and its verbs are the bulk bar's (Tables I §VIII). The menu replaces the browser's only on rows and objects. Text, links and fields keep the browser's own, because copy, paste and "open in new tab" are the user's, not the product's.
The keyboard gets there too. Shift+F10 and the menu key open the menu for the focused row, anchored to its ⋯ button rather than to a pointer that isn't there, and Escape returns focus to the row; shadcn/ui's context menu, on Radix, does the same. On touch, a long-press of 500ms opens it, but the ⋯ stays visible on every row, because a gesture with nothing on screen to suggest it is a shortcut and never the only way.
A menu hangs 8 below its trigger, start-aligned to a text button and end-aligned to a ⋯ at a row's end; it flips above when it won't fit below, and it is never clipped by the scroll container it was opened from, because it renders above the page at level 2. It enters at fast 150 on the enter curve, dropping 4px out of its trigger, and leaves at snap 60, in place.
Open the ⋯ on the top row and on the last one, with slow motion on to watch the 4px drop.
8 below, end-aligned to ⋯, flipped above near the bottom, unclipped · Right A child of the scroller, positioned below whatever the cost · WrongEight from the visible edge, and four of travel. The gap is Popover I §III's for every popover, 8, measured from the trigger's border box, and the ⋯ menu of Tables I §IX hangs at the same 8. The 4 that Motion I §IV gives a menu is the distance it travels while it appears, not where it comes to rest: it starts 4 nearer its trigger, at opacity 0, and settles at 8 in 150ms on cubic-bezier(0, 0, .2, 1). Flipped above, it rises instead of falling, so it always comes out of the trigger's side. It leaves by fading in place at snap 60 on the exit curve, one step down, because nobody watches a menu they've finished with; under reduced motion the travel is zero and the fade stays (Motion I §X). Only opacity and transform move.
Alignment from the trigger's shape. A text button has a start edge the eye follows, so the menu continues it; an icon button is centred on, by the same section, except that a ⋯ at the end of a row can't be centred on without the menu leaving the frame, so the first step of the collision order flips it to end-aligned, which is what Tables I draws. Near the bottom of the window the menu flips above its trigger rather than shrinking, and it shortens and scrolls only when neither side has room, eight from the viewport's edge.
Flip, never clip. The wrong frame is the easiest code there is: the menu is a child of the row it belongs to, absolutely positioned under its button, inside a table that scrolls. For the first rows it works. On the last rows it opens into the scroller's overflow and is cut off at the frame, and the buyer scrolls the table to reach Refuse, which scrolls the menu with it. Elevation II §VIII named the cause and Elevation I §VII the fix: render the menu outside every scroller, on the popover layer or in the browser's top layer, and position it against the viewport. It is opaque white at level 2, the key and ambient pair with a .10 hairline, and never translucent (Elevation II §II). It closes when the scroller it came from scrolls, since its trigger has moved out from under it, and it follows the trigger when the page scrolls.
A menu is fully usable without a pointer, by the WAI-ARIA menu button pattern. Enter, Space or ArrowDown on the trigger opens it on its first item, ArrowUp on its last; the arrows move and wrap, Home and End jump, a letter jumps to the next item that starts with it, and Enter activates. Escape closes and puts focus back on the trigger; Tab closes and moves on. Focus moves item to item, and one highlight follows both the keys and the pointer.
Open onto an item. Opened from the keyboard, the menu puts focus on its first item, so the next key acts on something; opened with ArrowUp it starts on the last, which is how a keyboard user reaches the last group in one press. Opened by a click, the menu takes focus itself with no item highlighted, so a pointer user who opened it doesn't see an item lit that they didn't choose, and the first ArrowDown lands on the first item. This is the menu button pattern as Radix implements it. The items are tabindex="-1" and focus moves among them, roving, so the browser's own focus is where the highlight is; the pointer moves focus too as it rests on an item, which means the keys always continue from where the pointer left off and there is only ever one highlighted item.
Type-ahead by the first letters. A letter moves to the next item whose label starts with it; letters typed within 500ms build a prefix, and the same letter pressed again cycles, so P reaches "Print packing slip" and a second P "Print pick list". Labels are matched, never shortcuts or group labels. This is the one argument in menus for starting labels with different words, and the one cost of starting a group's verbs with the same one; it is a small cost, and Print beside Print is worth it.
Escape gives focus back. Closing the menu without returning focus to the trigger is the most common keyboard bug in menus: focus falls to the page's body, and the next Tab starts again from the top of the page. Escape closes the menu and focuses the trigger; an activated item closes it and focuses the trigger, unless the item opened a dialog, which takes focus and returns it to the trigger when it closes (Modal I §VIII); Tab closes it and moves on to the control after the trigger. The shortcuts in the trailing column are not keys of the menu: ⌘D works with the menu closed, and inside the menu a D is type-ahead.
On touch the rows are 44, and below 640 the menu becomes a bottom sheet: full width, docked to the bottom edge, at level 3 over a scrim, with its rows at 14/20, no shortcuts, and the reason for a disabled item written under its label. A long-press on a row opens the same sheet as its ⋯. Shrinking the desktop menu onto a phone gives a 200 panel of 32 rows under the thumb that opened it.
Every live menu on this page becomes this sheet below 640px; open one on a phone, or narrow the window.
Forty-four, because a thumb is not a pointer. The 32 row is a mouse row; under a thumb it is two rows at once, and the slip of section V becomes the common case. Forty-four is the touch pitch every row in the series takes on touch, and the type steps up to 14/20, the comfortable voice, because the phone is held farther from the eye than its size suggests. The shortcut column goes: there is no keyboard to teach, and the space is better spent on the label.
A sheet below 640, because the thumb is at the bottom. An anchored menu opens under the button that opened it, which on a phone is under the finger that pressed it, and the first two items are hidden by the hand that wants them. A sheet docks to the bottom edge, where the thumb already is, takes the full width so its labels never truncate, and keeps the screen visible above it under the scrim, which is what Modal I §XIII did with the md dialog at the same breakpoint and what Elevation I predicted for menus: level 3 with a scrim, because on a phone the menu covers the page rather than floating beside its trigger. It rises at slow 300 and falls at base 200, the drawer's timing, and a tap on the scrim closes it. In a product its top carries the target's name as a group label, as the drawn sheet does, since the trigger it came from is no longer beside it.
The reason becomes a line. There are no tooltips on touch (Popover I §V), so a disabled item in a sheet sets its reason under its label at 12/16, in the muted ink, at full opacity: the item is dimmed, the explanation is not. A long-press on a row opens the same sheet its ⋯ opens, and the ⋯ stays visible, as section XI requires.
In dark mode the menu climbs to level 2 of the dark ramp, #282828 on the #121212 canvas, and a white hairline at .14 draws the edge its shadow can no longer draw. The separator is the same white .14, the highlight steps up to #363636, the shortcut takes the dark muted ink, and a disabled item keeps .45 of the light ink. Ported literals fail where they always do: the surface, the hairline and the muted ink.
The surface climbs and the edge takes over. A shadow barely registers on a #121212 page, so the dark menu says "above" with its surface instead, #282828, two steps up the ramp, and with its edge: the white .14 hairline that Popover I §XI gave the dark popover, plus a brighter top edge, which is Elevation II's opaque material in the dark (§IX). The shadow stays, darker, for the menus that open over a lighter surface. The highlight is #363636, the tooltip's surface, one step above the menu, and it has to be a step and not an alpha: a white at low alpha on #282828 reads as fog. The separator is the same white .14 as the edge, because in the dark the .10 of the light separator would be all but gone.
The inks are chosen against the dark surface. The label takes the dark primary #ecebe8 and the shortcut the dark muted #b0b0ae; the disabled item still multiplies its own ink by .45, which in the dark lands on a mid grey that reads as unavailable and can still be read. The readout measures each against the surface it sits on. Ported, the failures are the literals, as they were for the status marks: the #1a1a1a surface of a ported "dark" theme sits barely above the canvas with a shadow nobody can see, the .10 warm hairline and separator vanish, so the menu has no edge and its groups no boundaries, the light highlight #efede8 becomes a white bar brighter than any text on the screen, and the light muted ink falls well below 4.5:1 (Type III §VII).
Build a product's menus in this order; each step assumes the ones before it.
Steps one, four and five are the judgement; the rest are contracts written once and inherited by every menu. The audit: open every menu with the keyboard alone and close it with Escape, and see where focus lands; right-click every row and compare the items with its ⋯; find every greyed item and ask it why; look for an ellipsis on everything that asks and on nothing that doesn't; open the last row's menu in every scrolling table; take the screen to greyscale and find the destructive item by its place alone.
Search & Autocomplete (planned) takes the command palette, the menu of every action searched by name. Filters & Saved Views (planned) takes the popover forms that look like menus and aren't. Color (planned, written last) takes the hue a destructive item may add on top of its place, its separator and its word. A Part II would take the menu bar of a desktop application, menus with descriptions under their labels, menus that load their items, and the toolbar that collapses into a menu as the window narrows.
Part I of Menus.
A menu is a promise that the next click does one thing. Keep it by saying, before the click, what that thing is.