Adapt
On phones, things that pop up next to a button open as a bottom sheet instead — dropdown menus, right-click menus, the Moey dropdown list and calendars. Same markup, nothing to add: easier to reach with a thumb, never cut off at the edge of the screen.
<!-- Nothing special: on a phone these open as sheets -->
<div class="dropdown">
<button class="btn dropdown-toggle">Order #10421</button>
<div class="menu">…</div>
</div>
<select class="form-select" aria-label="Order status">…</select>
<input class="form-control" type="date" aria-label="Ship date">
- The sheet shows the field's name on top (from its
<label>oraria-label) and a handle. - Drag it down, tap outside, or press Esc to close. The page behind doesn't scroll while it's open.
- Items get taller, so they're easy to hit with a finger. Turning the phone or widening the window closes it.
Long-press menus
Right-click menus (data-moey-context) also open with a long-press on touch screens — iPhones included — and come up as a sheet on phones.
<div data-moey-context="#file-menu">Invoice-10421.pdf</div>
<div class="menu" id="file-menu" popover aria-label="File">…</div>
Searching on phones
Long lists get a search field. When you tap it, the sheet opens to its full height and sits right on the keyboard, so the results don't jump around as you type, and no page shows between the sheet and the keyboard. See Typing on phones.
Keep a pop-up
data-moey-adapt="false" on the menu, the field, any parent — or <html> for the whole site — keeps the normal pop-up on phones.
<div class="dropdown" data-moey-adapt="false">…</div>
<html data-moey-adapt="false"> <!-- the whole site -->