TaaviE
January 4, 2023, 12:01pm
1
How can I disable the awful hijack of right-click in code blocks when using the web client (>7.5)?
Hi TaaviE and welcome to the Mattermost forums!
You can use Shift-Rightclick in almost all browsers nowadays to workaround the right click overrides from websites. It also works with Mattermost, just tried it. As far as I know there’s no flag to disable the context menu from appearing, but using shift-click you can override the new behaviour.
1 Like
TaaviE
January 4, 2023, 2:25pm
3
Thanks for the reply, are there any plans on making this configurable?
Not that I’m aware of, but I’ll try to find someone who can answer this question.
1 Like
Hi again,
a GitHub issue has been created to address this topic - thanks for bringing it up!
opened 02:30PM - 10 Jan 23 UTC
Up For Grabs
Help Wanted
In the webapp, when you right-click on a code block in a message, we show a cust… om right-click context menu that offers two options:
* Copy
* Copy code block
Because this menu prevents the standard browser context menu, users can’t do everything they would expect to do with selected text in the browser.
In addition, code blocks now have a button to “copy code” when users hover over code blocks which is redundant with the custom context menu.

It is recommended that we remove the right-click hijacking and just use the standard browser behavior and let users use the “copy code” button that is available on hover of a code block.
This would mean the removal of the ‘Copy code block’ option entirely, but it does not seem different enough to warrant a completely separate function.
Conversation on community: [https://community.mattermost.com/core/pl/pwr3maeejfn57f7gueoijnozba](https://community.mattermost.com/core/pl/pwr3maeejfn57f7gueoijnozba)
----
If you're interested please comment here and come [join our "Contributors" community channel](https://community.mattermost.com/core/channels/tickets) on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please [join our "Developers" community channel](https://community.mattermost.com/core/channels/developers).
New contributors please see our [Developer's Guide](https://developers.mattermost.com/contribute/getting-started/).
JIRA: https://mattermost.atlassian.net/browse/MM-49528
Aaaaaaand it’s fixed and will be in the next release
mattermost:master
← GitStartHQ:MWAOSS-21
opened 06:07PM - 10 Jan 23 UTC
Summary
remove right-click hijacking on code blocks in messages
Ticket Link
…
Fixes https://github.com/mattermost/mattermost-server/issues/22040
Screenshots
Before:
<img width="404" alt="Screenshot 2023-01-10 at 20 52 50" src="https://user-images.githubusercontent.com/21334508/211627492-20d5ab7e-d7dd-431b-9419-28c66da2ffd6.png">
After:
<img width="651" alt="Screenshot 2023-01-10 at 20 55 43" src="https://user-images.githubusercontent.com/21334508/211627647-18758419-9d95-4eb5-b52d-81ec45d93b04.png">
### Release note
```release-note
Removed right-click hijacking on code blocks in messages
```
1 Like
TaaviE
January 19, 2023, 11:59am
7
Thanks! That’s nice to hear.