# Touch screens

> What works with a finger on phones and tablets, what needs a keyboard or a mouse, and how this is tested.

The spreadsheet is built for a keyboard and a pointer first. On a touch screen it is usable for reading, scrolling and editing single cells; several mouse gestures have no touch equivalent yet. This page lists both.

## What works

| Gesture | Result |
| --- | --- |
| Tap a cell | Selects it when the finger lifts. A tap on a row or column header selects the row or column. |
| Double tap a cell | Opens the cell editor with the on-screen keyboard. |
| Swipe | Scrolls the grid in both directions with the browser's own scrolling and momentum. The selection does not change. |
| Long press (about half a second) | Selects the cell if it is not selected and opens the context menu with cut, copy, paste, insert, delete, format and the other cell commands. |
| Tap a filter button, a slicer item, a sheet tab or a toolbar button | The same as a click. Toolbar buttons and sheet tabs are at least 24 by 24 CSS pixels. |
| Drag a selection handle | After a touch, the selection shows two round handles, just outside its top-left and bottom-right corners. Dragging one extends or shrinks the range from the opposite corner; near the edge of the grid the sheet scrolls along. The handles go away while a cell is edited, for whole rows and columns, and as soon as a mouse is used. |
| Drag the fill handle | In touch mode the fill handle is a larger square on the bottom edge of the selection, left of the corner so that it does not sit under the selection handle. Dragging it fills, as with a mouse. |
| Drag a selection border, a column or row edge, a picture, chart or shape | The same as with a mouse: moves or resizes. |
| Pinch | Zooms the page, as the browser does. Use the zoom slider in the status bar to zoom the sheet only. |

## What needs a keyboard or a mouse

- **Selecting a range by dragging across cells.** A finger that moves over cells scrolls. To select a range, tap the first cell and drag a selection handle, or type the range in the name box (`B2:D9`).
- **Selecting several separate ranges.** This needs `Ctrl` + click.
- **Hover.** Note previews and validation prompts appear on hover; on a touch screen open the note from the context menu, and the validation prompt shows when the cell is selected.
- **Split pane bars and freeze bars** can be dragged, but the top and left panes of a split scroll by wheel and keyboard only.
- **Key tips and shortcuts** need a keyboard.

The ribbon moves commands that do not fit into a **More commands** popup, which is what a phone-width screen shows for most of each tab. Set `toolbar: 'compact'` for a single row.

## How this is tested

`e2e/tests/spreadsheet-touch.spec.ts` runs in Chrome with touch emulation at 390 by 844 CSS pixels and sends real touch events: a tap and a double tap, swipes in both directions, a long press, and a measurement of every toolbar button and sheet tab. `e2e/tests/spreadsheet-touch-select.spec.ts` selects `B2:D6` by dragging the end handle, moves the start handle, fills by touch and checks that a swipe still scrolls; in Chrome it sends real touch events, in Firefox pointer events of type touch. The unit tests in `test/touch-input.test.ts` cover the same paths and the case where the browser takes a gesture over. Nothing has been tested on a physical phone or tablet, and nothing in Safari on iOS.
