# Right-Click and Double-Click Steps

> Teach a right-click menu or a double-click with Driver.js action steps that accept only that gesture and block the others.

Use this when the feature hides behind a gesture, like a context menu or a double-click to open. With `strict: true` the step takes only that gesture: a plain click on the file is blocked and shakes the popover instead of doing something else.

```js
const driverObj = driver({
  showButtons: ["close"],
  onElementMissing: "previousAction",
  steps: [
    {
      element: "#file",
      advanceOn: { event: "contextmenu", strict: true },
      allowedElements: ".file-menu",
      popover: {
        title: "Copy the file",
        instruction: "Right-click <b>report.pdf</b>.",
      },
    },
    {
      element: ".file-menu [data-action=duplicate]",
      waitForElement: 500,
      advanceOn: "click",
      allowedElements: ".file-menu",
      popover: {
        title: "Duplicate it",
        instruction: "Choose <b>Duplicate</b>.",
      },
    },
    {
      element: "#file-copy",
      waitForElement: 1000,
      advanceOn: { event: "dblclick", strict: true },
      popover: {
        title: "Open the copy",
        instruction: "Double-click <b>report copy.pdf</b>.",
      },
    },
  ],
});

driverObj.drive();
```

- Your app's own `contextmenu` and `dblclick` handlers run as usual. The step completes after them.
- `strict` blocks the other clicks on the element only. Clicks in `allowedElements`, like the menu, still work.
- iOS Safari never fires `contextmenu`. On touch devices, accept another event too, like `["contextmenu", "dblclick"]`, or offer a button that opens the same menu.

**Uses**: [`advanceOn` with `strict`](https://driverjs.com/docs/action-driven-tours.md#accept-only-the-right-gesture), [`allowedElements`](https://driverjs.com/docs/configuration.md#allowedelements), [`onElementMissing`](https://driverjs.com/docs/configuration.md#missing-elements)
