# Disable the KendoReact Chat Context Menu

## Environment

<table>
    <tbody>
        <tr>
            <td>Product Version</td>
            <td>16.0.0</td>
        </tr>
        <tr>
            <td>Product</td>
            <td>Progress® KendoReact Conversational UI</td>
        </tr>
    </tbody>
</table>

## Description

I want to disable the context menu when users right-click messages in the KendoReact Chat.

This KB also answers the following questions:

* How can I disable the context menu in the KendoReact Chat?
* How do I prevent the Chat context menu from opening on right-click?
* How do I prevent the browser and Chat context menus from opening when users right-click?

## Solution

Handle [`onContextMenuCapture`](https://react.dev/learn/responding-to-events#capture-phase-events) on a wrapper around the Chat. To disable only the Chat context menu and keep the browser's native menu available, call `stopPropagation` without calling `preventDefault`.

The following snippet prevents the Chat context menu while allowing the browser context menu:

```tsx
import * as React from 'react';
import { Chat } from '@progress/kendo-react-conversational-ui';

const preventChatContextMenu = (event: React.MouseEvent<HTMLDivElement>) => {
    event.stopPropagation();
};

const App = () => (
    <div onContextMenuCapture={preventChatContextMenu}>
        {/* Use your application's message collection here. */}
        <Chat messages={messages} authorId={1} />
    </div>
);
```

If you also want to disable the browser context menu, call `preventDefault` in the same capture handler:

```tsx
const preventAllContextMenus = (event: React.MouseEvent<HTMLDivElement>) => {
    event.preventDefault();
    event.stopPropagation();
};
```

Both approaches apply to all right-clicks inside the wrapper, including the input area.

## See Also

* [Message Tools](https://www.telerik.com/kendo-react-ui-develop/components/conversationalui/chat/messages/tools)
* [Chat API Reference](https://www.telerik.com/kendo-react-ui-develop/components/conversationalui/api)
