Skip to content
easeweb
Search topics

Right-click, long-press and swipe actions with no button

A list's actions sit in a menu that only a right-click or a long press opens, or behind a swipe, and no row has a button that reaches them.

WCAG 2.2
SC 2.1.1ASC 2.5.1A· new in 2.1
Required by
Section 508 · EN 301 549 (EU)
Broken list.addEventListener('contextmenu', openMenu)
The accessibility problem illustrated: Motor:How do I download it?
01

The problem

People who use a keyboard, a switch, voice control or a screen reader, and anyone who doesn't guess the gesture, can't reach a row's actions.

02

Try it

Delete “Signed contract.pdf”: right-click it, press and hold it, or in Broken 2, swipe it to the left. Then put the mouse aside and try with Tab.

The panel shows what a screen reader announces. Without the gesture, can you reach Download, Make a copy and Delete, and do you hear which file they are for?

Broken Can you fix this?

Shared documents

  • Invoice 0412.pdf
  • Signed contract.pdf
  • Brand guide.pdf

Help with shared files

Screen reader says:

(Tab to a file, or right-click one)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep the gesture as a shortcut, and give every row a button that reaches the same actions.

  1. 1Every action in the right-click, long-press or swipe menu is also on a button in the row, or in a menu that a button in the row opens.
  2. 2Those actions can be reached from the keyboard and say which row they act on.
  3. 3When an action removes a row, focus moves to the next row's controls, not the body.
Before

Actions only in a right-click or long-press menu

<ul class="files">  <li data-file="invoice">Invoice 0412.pdf</li>  <li data-file="contract">Signed contract.pdf</li>  <li data-file="brand">Brand guide.pdf</li></ul><div class="file-menu" hidden>  <button type="button" data-action="download">Download</button>  <button type="button" data-action="copy">Make a copy</button>  <button type="button" data-action="delete">Delete</button></div>
After

An Actions menu button that opens the same actions

<li data-file="invoice">  <span id="file-invoice">Invoice 0412.pdf</span>  <button type="button" popovertarget="menu-invoice" aria-haspopup="menu" aria-describedby="file-invoice">    Actions  </button>  <div id="menu-invoice" popover role="menu" aria-labelledby="file-invoice" class="file-menu">    <button type="button" role="menuitem" tabindex="-1" data-action="download">Download</button>    <button type="button" role="menuitem" tabindex="-1" data-action="copy">Make a copy</button>    <button type="button" role="menuitem" tabindex="-1" data-action="delete">Delete</button>  </div></li>

Fixing this with an AI coding assistant? Get this guide as Markdown

04

Verify the fix

5 checks.

Test with: Keyboard, Mouse, Touch, Screen reader, Speech input

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the list component or its menu library changes.

Limits

This is a starting pattern, not a guarantee for every application. Rows moved by dragging, long-press selection of several items, and gestures on maps and images such as pinch to zoom have their own needs, and are not covered here; for those, see pinch, drag and tilt gestures with no button. Menu libraries differ in how they handle focus, Escape and placement: test the complete journey with your target assistive technology.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work