---
id: api/commands/rightclick
title: rightclick | Cypress Documentation
description: Right click a DOM element in Cypress.
section: api
source_path: docs/api/commands/rightclick.mdx
version: 7ada28c0cd90e81cf56fd3fc73de6e6d45c16de6
updated_at: '2026-05-13T21:55:41.935Z'
---
# rightclick

Right click a DOM element.

It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the subject after `.rightclick()`.

`.rightclick()` will not open context menus native to the browser. `.rightclick()` should be used to test your app's handling of right click related events such as `contextmenu`.

## Syntax

```
.rightclick().rightclick(options).rightclick(position).rightclick(position, options).rightclick(x, y).rightclick(x, y, options)
```

### Usage

**Correct Usage**

```
cy.get('.menu').rightclick() // Right click on .menucy.focused().rightclick() // Right click on el with focuscy.contains('Today').rightclick() // Right click on first el containing 'Today'
```

**Incorrect Usage**

```
cy.rightclick('button') // Errors, cannot be chained off 'cy'cy.window().rightclick() // Errors, 'window' does not yield DOM element
```

### Arguments

**position _(String)_**

The position where the right click should be issued. The `center` position is the default position. Valid positions are `topLeft`, `top`, `topRight`, `left`, `center`, `right`, `bottomLeft`, `bottom`, and `bottomRight`.

**x _(Number)_**

The distance in pixels from the element's left to issue the right click.

**y _(Number)_**

The distance in pixels from the element's top to issue the right click.

**options _(Object)_**

Pass in an options object to change the default behavior of `.rightclick()`.

| Option | Default | Description |
| --- | --- | --- |
| `altKey` | `false` | Activates the alt key (option key for Mac). Aliases: `optionKey`. |
| `animationDistanceThreshold` | [`animationDistanceThreshold`](/llm/markdown/app/references/configuration.md#Actionability) | The distance in pixels an element must exceed over time to be [considered animating](/llm/markdown/app/core-concepts/interacting-with-elements.md#Animations). |
| `ctrlKey` | `false` | Activates the control key. Aliases: `controlKey`. |
| `force` | `false` | Forces the action, disables [waiting for actionability](#Assertions) |
| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |
| `metaKey` | `false` | Activates the meta key (Windows key or command key for Mac). Aliases: `commandKey`, `cmdKey`. |
| `multiple` | `false` | Serially click multiple elements |
| `scrollBehavior` | [`scrollBehavior`](/llm/markdown/app/references/configuration.md#Actionability) | Viewport position to where an element [should be scrolled](/llm/markdown/app/core-concepts/interacting-with-elements.md#Scrolling) before executing the command |
| `shiftKey` | `false` | Activates the shift key. |
| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.rightclick()` to resolve before [timing out](#Timeouts) |
| `waitForAnimations` | [`waitForAnimations`](/llm/markdown/app/references/configuration.md#Actionability) | Whether to wait for elements to [finish animating](/llm/markdown/app/core-concepts/interacting-with-elements.md#Animations) before executing the command. |

### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)

*   `.rightclick()` yields the same subject it was given.
*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the subject after `.rightclick()`.

## Examples

### No Args

#### Right click the menu

```
cy.get('#open-menu').rightclick()
```

### Position

#### Specify a corner of the element to right click

Right click the top right corner of the DOM element.

```
cy.get('#open-menu').rightclick('topRight')
```

### Coordinates

#### Specify explicit coordinates relative to the top left corner

The right click below will be issued inside of the element (15px from the left and 40px from the top).

```
cy.get('#open-menu').rightclick(15, 40)
```

### Options

#### Force a right click regardless of its actionable state

Forcing a right click overrides the [actionable checks](/llm/markdown/app/core-concepts/interacting-with-elements.md#Forcing) Cypress applies and will automatically fire the events.

```
cy.get('#open-menu').rightclick({ force: true })
```

#### Force a right click with position argument

```
cy.get('#open-menu').rightclick('bottomLeft', { force: true })
```

#### Force a right click with relative coordinates

```
cy.get('#open-menu').rightclick(5, 60, { force: true })
```

#### Right click all buttons found on the page

By default, Cypress will error if you're trying to right click multiple elements. By passing `{ multiple: true }` Cypress will iteratively apply the right click to each element and will also log to the [Command Log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) multiple times.

```
cy.get('.open-menu').rightclick({ multiple: true })
```

#### Right click with key combinations

The `.rightclick()` command may also be fired with key modifiers in order to simulate holding key combinations while right clicking, such as `ALT + rightclick`.

You can also use key combinations during [.type()](/llm/markdown/api/commands/type.md). This offers options to hold down keys across multiple commands. See [Key Combinations](/llm/markdown/api/commands/type.md#Key-Combinations) for more information.

The following key can be combined with `.rightclick()` through the `options`..

| Option | Notes |
| --- | --- |
| `altKey` | Activates the alt key (option key for Mac). Aliases: `optionKey`. |
| `ctrlKey` | Activates the control key. Aliases: `controlKey`. |
| `metaKey` | Activates the meta key (Windows key or command key for Mac). Aliases: `commandKey`, `cmdKey`. |
| `shiftKey` | Activates the shift key. |

##### Command right click

```
// execute a CMD + right click on the .menu-itemcy.get('.menu-item').rightclick({  metaKey: true,})
```

## Notes

### Actionability

#### The element must first reach actionability

`.rightclick()` is an "action command" that follows all the rules of [Actionability](/llm/markdown/app/core-concepts/interacting-with-elements.md).

## Rules

### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)

*   `.rightclick()` requires being chained off a command that yields DOM element(s).

### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)

*   `.rightclick()` will automatically wait for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).
*   `.rightclick()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until all chained assertions have passed.

### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)

*   `.rightclick()` can time out waiting for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).
*   `.rightclick()` can time out waiting for assertions you've added to pass.

## Command Log

**_Right click the DOM element_**

```
cy.get('.rightclick-action-div').rightclick()
```

The commands above will display in the Command Log as:

When clicking on `rightclick` within the command log, the console outputs the following:

## History

| Version | Changes |
| --- | --- |
| [6.1.0](/llm/markdown/app/references/changelog.md#6-1-0) | Added option `scrollBehavior` |
| [3.5.0](/llm/markdown/app/references/changelog.md#3-5-0) | `.rightclick()` command added |

## See also

*   [`.click()`](/llm/markdown/api/commands/click.md)
*   [`.dblclick()`](/llm/markdown/api/commands/dblclick.md)
*   [`.trigger()`](/llm/markdown/api/commands/trigger.md)
